Skip to content

title: "vbmClearSprite2" description: TRSE built-in method (from IDE help)


vbmClearSprite2

Systems: VIC20
Parameters: a, a, a


vbmClearSprite2( [address1], [address2] );

  • [address1] - pre-shifted address table for the left side of an 16x8 sprite
  • [address2] - pre-shifted address table for the middle of an 16x8 sprite
  • [address3] - pre-shifted address table for the right side of an 16x8 sprite

Description

A simple sprite routine to erase or cut-out a 16x8 sprite on the bitmap.

Only three parameters are required; the addresses of the pre-shifted 'address table' for the left, middle and right side of a sprite. The pre-shifted address table is a list of addresses to point to where each pre-shifted frame can be found in memory.

For example: $a000, $a080, $a1000, $a180

The address table will need to be defined if you import your sprites already pre-shifted. If you use the vbmSpriteShiftL / R commands, these will build the address table for you.

Limitations

Some compromises have been made for the basic 16x8 sprite command.

Firstly, it will write the sprite to wherever the built in screenmemory zero page pointer is pointing to. This could be partly outside of the bitmap memory ($1100 to $1FFF) if you position your sprite off of the screen edges. Therefore, do not use this command if you wish to place sprite your sprite partly off the screen.

Secondly, this sprite command cannot be used with the vbmScrollLeft / Right commands which re-arrange the character map used for the bitmap.

Should either of the above be requirements, use vbmSpriteSlice instead which allows you to draw each sprite column seperately and you can specify the start and end line of the sprite to draw. As such you can only draw the columns and lines as needed in the correct locations.

There are three ways to draw a sprite:

  • vbmDrawSprite2 - draws a sprite, merging it with the bitmap
  • vbmDrawSprite2E - draws a sprite, merging it with the bitmap using the EOR operation
  • vbmClearSprite2 - clears a sprite from the bitmap, effectively 'cutting it out'

See also

  • vbmDrawSprite8
  • vbmDrawSprite16
  • vbmSetPosition1 / 2 / 4