SPRITE LOAD file
SPRITE ON n, x, y [, color]
SPRITE MOVE n, x, y [, color]
SPRITE COPY s1 TO s2
SPRITE OFF n [, n [, …]]
SPRITE OFF ALL
SPRITE PASTE n, x, y
Load and manipulate sprites on the screen. Sprites are 16×16 pixel objects that can be moved about on the screen without erasing or disturbing text or other underlying graphics. This command is mostly used in animated games.
‘n’ is the sprite number, ‘x’ and ‘y’ are the sprite’s coordinates on the screen.
SPRITE LOAD will load a sprite file into memory. This file defines the graphic images of one or more sprites.
SPRITE ON will display an individual sprite contained in the sprite file.
SPRITE MOVE will move the sprite to a new location and restore the background at the old location.
For both ON and MOVE ‘color’ can be optionally specified and this color will be used for the background. When using a solid background color this is faster and does not require special handling for overlapping sprites.
SPRITE COPY will copy the bitmap for sprite s1 into the bitmap for sprite s2. If the destination sprite (‘n2’) is currently on (ie, displayed) then this command will perform the equivalent of SPRITE OFF, COPY then ON again. This can be used for animation of multiple sprites that use the same bitmaps.
For example, sprites 1 to 4 can be the bitmap of a running man in various poses and sprites 5 to 10 can be blank. Sprites 1 to 4 can then be copied into sprites 5 to 10 as required by the animation and then displayed using SPRITE ON. This would result in six copies of the running man on the screen.
SPRITE OFF will remove the sprite from the screen and restore the background graphics that was obscured when the sprite was turned on.
A number of sprites may be quickly removed in sequence by specifying a comma separated list. ie, SPRITE OFF 4, 8, 2, 3. As a shortcut SPRITE OFF ALL will remove all active sprites.
SPRITE PASTE will simply copy the sprite bitmap to the video screen. There is no need to turn the sprite on or off and the background is not saved therefor the sprite bitmap will become part of the background.
SPRITE UNLOAD will disable the sprites, unload the file and reclaim the memory used.
The sprite file can contain many individual sprites which can be simultaneously displayed and independently manipulated at the same time. The number of sprites is limited only by the available memory.
Also see the function COLLISION() for collision detection.
VGA screen resolution is 480 horizontal by 432 vertical in modes 1-3, and 240×416 in mode 4. PAL composite is 304 by 216 and NTSC composite is 304 by 180.