Problem change sprite size in game
Posted: Fri Jun 10, 2016 2:19 pm
Hi,
In game, I change the tile of a sprite, resize the sprite and setposition.
With the old sgdk, all works in on frame.
With the new. The first frame show the new tile but old sprite size and the next frame evrything works.
As an example, made with photoshop to show you

In Purple, 2 sprites (32*32). In yellow, loading new tiles, In green : new sprite size and position.
In game, I change the tile of a sprite, resize the sprite and setposition.
With the old sgdk, all works in on frame.
With the new. The first frame show the new tile but old sprite size and the next frame evrything works.
As an example, made with photoshop to show you

In Purple, 2 sprites (32*32). In yellow, loading new tiles, In green : new sprite size and position.
Code: Select all
//load new bitmap tiles
u16 wm = nTiles.w;
u16 hm = nTiles.h;
VDP_loadBMPTileData((u32*) nTiles.image, nIndex, wm / 8, hm / 8, wm / 8 );
//new position and new size
players[0].posY = FIX32(112) + FIX32(16);
players[1].posY = FIX32(112) + FIX32(32);
players[0].posX = players[1].posX + FIX32(16);
players[0].size_spriteH = 2;
players[0].size_spriteV = 2;
players[1].size_spriteH = 4;
players[1].size_spriteV = 4;
players[1].index = players[0].index + 4;
players[0].numanim++;
//change sprite value
VDP_setSprite(players[0].numSprite, fix32ToInt(players[0].posX), fix32ToInt(players[0].posY), SPRITE_SIZE(players[0].size_spriteH,players[0].size_spriteV), TILE_ATTR_FULL(players[0].nPal, 0, 0, 0, players[0].index));
VDP_setSprite(players[1].numSprite, fix32ToInt(players[1].posX), fix32ToInt(players[1].posY), SPRITE_SIZE(players[1].size_spriteH,players[1].size_spriteV), TILE_ATTR_FULL(players[1].nPal, 0, 0, 0, players[1].index) );