SPRITE

v3.1 C64 C128

The SPRITE command sets various properties of a single sprite, including visibility, shape, color, etc.

Syntax

SPRITE <spr_no> <subcommand> <subcommand> ...

Where <spr_no> is an expression that evaluates to a number between 0 and 7 and <subcommand> is one of:

  • ON or OFF
  • AT <x>, <y>
  • SHAPE <n>
  • COLOR <c>
  • HIRES or MULTI
  • XYSIZE <x>, <y>
  • ON BACKGROUND or UNDER BACKGROUND

Examples

SPRITE 0 SHAPE 4 ON AT 160, 100 COLOR 1
SPRITE 1 OFF
' Notice: the _ character splits long lines
SPRITE 2 _
  SHAPE 3 _
  ON _
  AT 50, 50 _
  MULTI _
  UNDER BACKGROUND

SPRITE ON / OFF

Enables or disables sprite visibility, for example:

SPRITE 0 OFF
SPRITE 1 ON

SPRITE AT

Locates sprite at the given co-ordinates on screen. For example:

SPRITE 5 AT 100, 140

will position sprite 5 at location (100,140).

SPRITE SHAPE

Sets the address where the bitmap data of a sprite is stored in memory. This memory address is relative to the currently selected VIC bank and is calculated with the following formula:

address = VIC bank start + 64 * sprite shape

For example:

SPRITE 0 SHAPE 128

will set the address 0 + 128 * 64 = 8192 ($2000) for sprite 0, the default VIC bank address being 0.

SPRITE COLOR

Sets the individual sprite color to the desired value.

CONST RED = 2
SPRITE 1 COLOR RED

Note: global colors of multicolor sprites can be set using the SPRITE MULTICOLOR command.

SPRITE HIRES / MULTI

Switches between high-resolution mode and multicolor mode for a single sprite.

SPRITE 7 MULTI
SPRITE 5 HIRES

SPRITE XYSIZE

Sets horizontal and vertical stretching of a sprite. A zero value sets normal size, any other values set expanded size.

SPRITE 0 XYSIZE 0, 0 ' Normal size
SPRITE 1 XYSIZE 1, 0 ' Horizontally stretched
SPRITE 2 XYSIZE 0, 1 ' Vertically stretched
SPRITE 3 XYSIZE 1, 1 ' Stretched in  both directions

SPRITE ON/UNDER BACKGROUND

Sets whether the sprite is displayed before or behind background graphics.

SPRITE 0 ON BACKGROUND
SPRITE 1 UNDER BACKGROUND