Mode 2 Sprites Guide

From Uzebox Wiki
Jump to: navigation, search

Hello there. If you're reading this then odds are you just joined the Uzebox community. Glad to have you aboard. Video Mode 2 has support for up to 32 sprites (31 usable), each 6x8 pixels. There can be five for each scan line.

In the current implementation, sprite #0 is not usable and it's tileIndex property *must* point to a fully transparent tile (or you will see vertical bands on the screen).

Sprites are accessed through the sprite array. There are only three variable names you need to know. x, y, and tileIndex.

x: The x value of the sprite.

y: The y value of the sprite.

tileIndex: The tile for the sprite.

For example:

               sprites[5].x = 10;
               sprites[5].y = 40;
               sprites[5].tileIndex = 12;

sets sprite 5 at (10,40) with tile number 12 as its sprite.

You can also use the command SetSpritesTileTable() to set which Sprite Table you want to use.

For Example:


sets the sprite table to My Sprites.

Finally, you may want to have more than 5 sprites on a scanline. By default, excess sprites are ignored and won't display at all. By using SetSpritesOptions(), you can enable or disable sprite flickering.

The two possible options are:

SPR_OVERFLOW_ROTATE: For each scanline with more than five sprites the sprites will flicker making them all visible, but flickery.

SPR_OVERFLOW_CLIP: Every sprite after the fifth for each scanline is not displayed.

For example:


tells the kernel cause the sprites to flicker.

That's it. Have Fun