I try to setup a tilemap engine.
a kind of "splash screen" in "plan a"
Code: Select all
VDP_drawImageEx(PLAN_A, &bga_image, TILE_ATTR_FULL(PAL1, TRUE, FALSE, FALSE, ind), 0, 0, FALSE, TRUE);
ind += logo2_image.tileset->numTile;
Code: Select all
for(z=0;z<38;z+=2)
{
for(i=0;i<22;i+=2) // when i reaches 42 tiles it stops drawing. it skips 2 tiles (block width)
{
drawBlock(z+1,i+1,4); //Function drawBlock draws block at position horizontal i and vertical 20
w+=2;
if (w==41){
w=81;}
if (w==121){
w=161;}
ind+=4;
}
}
Code: Select all
void drawBlock(unsigned int px,unsigned int py, unsigned int tnum) //Function to draw block at px,py
{ //16x16 pixel block = four 8x8 tiles = 2 tile wide and 2 tile high
VDP_setTileMapXY(PLAN_B, TILE_ATTR_FULL(PAL0, 0, 0, 0, tnum), px, py); //Tile 2 is upper left corner (8x8 tile)
VDP_setTileMapXY(PLAN_B, TILE_ATTR_FULL(PAL0, 0, 0, 0, tnum)+1, px+1, py); //Tile 3 is upper right corner (8x8 tile)
VDP_setTileMapXY(PLAN_B, TILE_ATTR_FULL(PAL0, 0, 0, 0, tnum)+40, px, py+1); //Tile 4 is lower left corner
VDP_setTileMapXY(PLAN_B, TILE_ATTR_FULL(PAL0, 0, 0, 0, tnum)+41, px+1, py+1); //Tile 5 is lower right corner
}
If i try to put more tiles on screen the graphics i put in "PLAN_A" go messy.
(some tiles from "PLAN_A" start looking weird an do some twisting
kind of animation)
Except for
Code: Select all
VDP_fillTileMapRect(PLAN_B, 1, 0, 0, 50, 38);
1.
is there a smarter way to fill the screen with "different" tiles?
2.
another thing i saw was that i always have to fill some "IND" value when i draw with VDP_setTileMapXY or VDP_drawImageEx, else everything looks crap too, except for the VDP_fillTileMapRect, which does´nt seem to need that value. ind = TILE_USERINDEX;
can someone explain that a little more?