This function can be used to define a hardware sprite. The first parameter must
be a monochrome graphics resource, while the second parameter (optional) can be
the identifier of an already defined sprite. If the second parameter is omitted,
the sprite will be created using a new identifier.
A sprite declaration can be followed by one or more optional flags that serve
to better describe the desired characteristics of the sprite.
With the MULTICOLOR
flag you can indicate that the sprite is defined by more
than one color. Depending on the video chipset considered, this can mean up to
4 colors instead of the single color. The opposite is given by the MONOCOLOR
flag, which defines a monochrome sprite.
The EXPAND VERTICAL
flag allows you to increase the height of the sprite
and, depending on the video chipset considered, each pixel of the sprite will
be drawn with more pixels on the screen. The opposite is obtained with the
COMPRESS VERTICAL
flag.
The EXPAND HORIZONTAL
flag allows you to increase the width of the
sprite and, depending on the video chipset considered, each pixel of the
sprite will be drawn with more pixels on the screen. The opposite is
obtained with the COMPRESS HORIZONTAL
flag.
The last flag is IGNORE COLOR
, which allows you to indicate the color to be
considered as transparency (that is: ignored).
Please note that defining a sprite allows you to change its appearance
dynamically, and therefore allows you to perform (for example) animations.
This redefinition should be understood as synchronous, and therefore the
program should be written to ensure the appropriate timing, in order to
avoid flickering.
= SPRITE( resource ) flags = SPRITE( resource, old ) flags
ship = SPRITE( imageShip ) IGNORE BLACK
Join BASIC 10Liner Contest with ugBASIC!
An interesting competition is held at the beginning of each year: the
BASIC 10Liner Contest.
It is possible to use ugBASIC to participate in the next
"BASIC10Liner" competition, in the following categories:
SPRITE (function) ↔ Spr
If you have found a problem with this keyword, if you think there is a bug or, more
simply, you would like it to be improved, open an issue for this example on GitHub.
Thank you!
open an issue
BACK TO KEYWORDS