Amos Professional Manual  Contents  Index

Hardware Sprites


The Sprite command

SPRITE
instruction: display a Sprite on the screen
Sprite Sprite number
Sprite Sprite number,hx,hy,image number

The SPRITE command assigns an image to a Sprite, and displays it at the selected hardware coordinates.

The Sprite number can range from 0 to 63. Normally, Sprite number zero is not available because it is already allocated to the mouse pointer. To ensure that you have the maximum number of Sprites at your disposal, remove the mouse pointer from the screen with HIDE ON. Sprite identification numbers from 0 to 7 refer to the eight hardware Sprites whose limitations have already been explained. You will probably want to make use of the AMOS Professional computed Sprites in your programs instead, and these are assigned the numbers from 8 to 63.

The hardware coordinates hx and hy set the position at which the Sprite will be displayed. Since Sprites are totally independent from the current screen, normal screen coordinates cannot be used for this purpose. Instead, all Sprites are positioned by special hardware coordinates as used by the mouse pointer and the SCREEN DISPLAY command. Hardware coordinates can be converted from normal screen coordinates by the X HARD and Y HARD functions, which are explained later.

The position of the Sprite is measured from a single spot related to that Sprite, known as the "hot spot". This is usually taken to be the top left-hand corner of the Sprite, but it can be placed anywhere you like using the HOT SPOT command. Hot spots are explained in detail near the end of this Chapter.

When the Sprite has been allocated an identification number and given its display coordinates, you must select an image for the Sprite to display. Images are created using the Object Editor (there is a guided tour of this process in Chapter 13.2) and deposited in the Object Bank, which is normally memory bank 1. Each image in this bank is assigned its own number, starting from one. To select an image for a Sprite to display, simply give the appropriate image number. Sprite images may be installed into your programs using the LOAD command, like this:

X> Load "Sprites.Abk"

Once images have been installed in this way they will be saved along with your AMOS Professional programs automatically.

The image number and coordinate parameters can be omitted after a SPRITE command, but the appropriate commas must be included.

Back    Next
07.01.04