Amos Professional Manual  Contents  Index

Hardware Sprites


sprites are exactly the same. A procedure is provided to accomplish this, and it may be found along with a host of other useful procedures, in Appendix C.

GET SPRITE PALETTE
instruction: grab sprite colours into screen
Get Sprite Palette
Get Sprite Palette mask

This command copies the colour values used by your Sprite and Bob images and loads them into the current screen. It is an intelligent instruction, so if 16-colour screens are in use, values are automatically copied into colour registers 16 to 31. This means that you can use the same images for either Bobs or Sprites with no risk of colour clashes! Here is an example:

E> Load "AMOSPro Tutorial:Objects/Sprites.Abk"
   Curs Off : Flash Off : Cls 0
   Get Sprite Palette
   Rem Set computed Sprite at hardware coords 128,50 using image 1
   Sprite 8,128,50,1
   Wait Key

The optional mask parameter allows the colour selection to be limited. Each colour is represented by a single digit in a 32-digit bit mask. If the appropriate digit is set to 1, the colour is copied from the Object Bank. Any colours to be omitted (masked) should have their digit set to 0. The following example copies colours 0 to 3 from the Object Bank into the screen:

X> Get Sprite Palette %0000000000001111

Because the mask is entered as a normal number, either hexadecimal or decimal modes can also be used:

X> Get Sprite Palette $FFFF0000

Please note that the GET BOB PALETTE and GET OBJECT PALETTE instructions perform an identical task to the GET SPRITE PALETTE command.

GET SPRITE
instruction: grab screen image into the Object Bank
Get Sprite image number,x1,y1 To x2,y2
Get Sprite screen number,image number,x1,y1 To x2,y2

Use this command to grab images directly from the screen and transform them into Sprites. Simply define the new image number, then give the coordinates, from top left-hand to bottom right-hand corner, of the rectangular area to be loaded into the Sprite Bank. The image will be grabbed from the current screen unless an optional screen number is specified.

Provided that the given coordinates lie inside of existing screen borders, there are no limitations to the area that can be grabbed in this way.

Back    Next
07.01.07