Function MapSprite

From Uzebox Wiki
Jump to: navigation, search
Prototype

void MapSprite(unsigned char startSprite, const char *map);

Description

Convenience function that uses a map to draw big sprites (composed of multiple 8x8 sprites). It assigns map indexes to sprites indexes and re-positions the sprites to tile them using the width and height specified in the map.

Parameters
  • startSprite: The first sprite index from which to apply the map.
  • map: A regular map that contains sprites tile indexes.
Returns

Void

Video Modes

2,3

Since

V1

Example: This example creates a 2x2 'big sprite'. Its maps starting at sprite #3, so sprites 3,4,5 & 6 will be occupied after calling the MapSprite() function.

#include "my_sprites_tiles_data.inc";
const char my_sprite_map[] PROGMEM={2,2, 3,8, 4,1};
...
SetSpritesTileTable(my_sprites_tile_data);
MapSprite(3,my_sprite_map);
MoveSprite(3,120,110,2,2); //adjusts the positions of sprites 3 to 6