I was using VDP_setMapEx() with h.scroll with success, but actually I'm trying to do a different thing and not sure what's happening.
I use VDP_drawImageEx() to draw a background image in PLAN_B (from a PNG file). This one with castle:
This is ok.
Now I want to draw 2 towers in PLAN_A. I don't want to use sprites to avoid flickering. Towers like this one (72x88px):
But we will start with only 1 tower, easy way. I want tower to be damaged. So I put 3 different tower desings in one file, and tried to use VDP_setMapEx() to draw it, it depends of the damaged suffered by tower:
This is the code:
Code: Select all
#include <genesis.h>
#include "config.h"
#include "sprite.h"
#include "fondos.h"
//declaracion de variables
static u16 idx_tile_malloc, idx_tile_malloc2;
int main() {
VDP_setScreenWidth320();
VDP_setPalette(PAL0,fondo01_01.palette->data);
//PLAN_B
VDP_drawImageEx(PLAN_B, &fondo01_01, TILE_ATTR_FULL(PAL0, FALSE, FALSE, FALSE, 0), 0, 0, FALSE, TRUE);
idx_tile_malloc += fondo01_01.tileset->numTile;
//PLAN_A
Map *mapTorre1 = unpackMap(fondo01_01_T1A.map, NULL);
VDP_loadTileSet(fondo01_01_T1A.tileset, idx_tile_malloc, CPU);
VDP_setMapEx(PLAN_A, mapTorre1, TILE_ATTR_FULL(PAL0, FALSE, FALSE, FALSE, idx_tile_malloc), 0, 4, 0, 0, 9, 11);
idx_tile_malloc2 += fondo01_01.tileset->numTile;
//BUCLE PRINCIPAL
while (1) {
VDP_waitVSync();
}
return 0;
}