title: "vbmSetPosition2" description: TRSE built-in method (from IDE help)
vbmSetPosition2
Systems: VIC20
Parameters: b,b
vbmSetPosition2( [x-byte], [y-byte] );
- [x-byte] - X location in pixels
- [y-byte] - Y location in pixels
Description
Sets the inbuilt zero page pointer called ScreenMemory to the address in the bitmap corresponding to the location for the given X and Y position. The built in variable called vbmX is set to a value between 0 and 3 which is the pre-shifted offset to use to correctly display a sprite. This is suitable for multicoloured sprites that use two bits per pixel.
There are three vbmSetPosition commands, one for each type of pre-shifted sprites you wish to use:
- vbmSetPosition1 - for sprites that are pre-shifted 1 pixel at a time
- vbmSetPosition2 - for sprites that are pre-shifted 2 pixels at a time
- vbmSetPosition4 - for sprites that are pre-shifted 4 pixels at a time
Ensure you use the correct command for your pre-shifted sprites.
Example
// assume using 2 pixel pre-shifted sprites, therefore a total of 4 pre-shifted positions
vbmSetPosition2( 35, 100 );
vbmDrawSprite8( sprLeftSide, sprRightSide ); // 8x8 sprites need two character columns
vbmSetPosition2( 100, 100 );
vbmDrawSprite16( sprLeftSide, sprMiddle, sprRightSide ); // 16x16 sprites need three character columns
See also
- vbmNextColumn
- vbmSetColumn