Available on: c64 c64reu c128 msx1 coleco sc3000 sg1000
See also: SPRITE

SPRITE (function)

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.

SYNTAX

 = SPRITE( resource ) flags
 = SPRITE( resource, old ) flags


Legend
  • id : identifier
  • type : datatype
  • v : value
  • "..." : string
  • [...] : optional

EXAMPLE

 ship = SPRITE( imageShip ) IGNORE BLACK


ABBREVIATION: Spr

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:

  • PUR-120 - A game in 10 lines of max 120 characters (w/abbrev.)
  • EXTREME-256 - A game in 10 lines of max 256 characters (w/abbrev.)
  • SCHAU - Any program in 10 lines of max 256 characters (w/abbrev.)
In order to reduce space you can use this abbreviation for this instruction:

SPRITE (function) ↔ Spr

Any problem?

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