max sprite per line
Posted: Mon Jun 29, 2015 12:16 pm
Hello, I have already done tests and read some posts but I found no solutions.
I want to display 20 sprites per line on each other. When I display all sprites, I have piece of spites disappear. I checked in the debugger of genskmod and all my sprites are on the screen and with the right number of tiles.
You can see from the image, the blue sprites are squares of 32 * 32 pixels but them does not appear under all the red sprites.
I have certainly misunderstanding something.
And I have a compilation warning like you'll see on the second screen. With the pointer of SPR_initSprite.


If someone can help me!
regards.
I want to display 20 sprites per line on each other. When I display all sprites, I have piece of spites disappear. I checked in the debugger of genskmod and all my sprites are on the screen and with the right number of tiles.
You can see from the image, the blue sprites are squares of 32 * 32 pixels but them does not appear under all the red sprites.
I have certainly misunderstanding something.
And I have a compilation warning like you'll see on the second screen. With the pointer of SPR_initSprite.


Code: Select all
// sprites structure
Sprite sprites[20];
int main()
{
u16 palette[64];
u16 ind;
// initialization
VDP_setScreenWidth320();
// init sprites engine
SPR_init(256);
camposx = -1;
camposy = -1;
posx = FIX32(48);
posy = MAX_POSY;
movx = FIX32(0);
movy = FIX32(0);
xorder = 0;
yorder = 0;
sprposx = 10;
sprposy = MAX_POSY;
// init scrolling
updateCamera(FIX32(0), FIX32(0));
// init sonic sprite
SPR_initSprite(&sprites[0], &sonic_sprite, fix32ToInt(posx - camposx + sprposx), fix32ToInt(posy - camposy), TILE_ATTR(PAL2, TRUE, FALSE, FALSE));
sprposx += FIX32(15);
SPR_initSprite(&sprites[1], &sonic_sprite, fix32ToInt(posx - camposx + sprposx), fix32ToInt(posy - camposy ), TILE_ATTR(PAL2, TRUE, FALSE, FALSE));
sprposx += FIX32(15);
SPR_initSprite(&sprites[2], &sonic_sprite, fix32ToInt(posx - camposx + sprposx), fix32ToInt(posy - camposy ), TILE_ATTR(PAL2, TRUE, FALSE, FALSE));
sprposx += FIX32(15);
SPR_initSprite(&sprites[3], &sonic_sprite, fix32ToInt(posx - camposx + sprposx), fix32ToInt(posy - camposy ), TILE_ATTR(PAL2, TRUE, FALSE, FALSE));
sprposx += FIX32(20);
SPR_initSprite(&sprites[4], &sonic_sprite, fix32ToInt(posx - camposx + sprposx), fix32ToInt(posy - camposy ), TILE_ATTR(PAL2, TRUE, FALSE, FALSE));
sprposx += FIX32(25);
SPR_initSprite(&sprites[5], &sonic_sprite, fix32ToInt(posx - camposx + sprposx), fix32ToInt(posy - camposy ), TILE_ATTR(PAL2, TRUE, FALSE, FALSE));
sprposx += FIX32(15);
SPR_initSprite(&sprites[6], &sonic_sprite, fix32ToInt(posx - camposx + sprposx), fix32ToInt(posy - camposy ), TILE_ATTR(PAL2, TRUE, FALSE, FALSE));
sprposx += FIX32(15);
SPR_initSprite(&sprites[7], &sonic_sprite, fix32ToInt(posx - camposx + sprposx), fix32ToInt(posy - camposy + sprposy), TILE_ATTR(PAL2, TRUE, FALSE, FALSE));
sprposx += FIX32(15);
SPR_initSprite(&sprites[8], &sonic_sprite, fix32ToInt(posx - camposx + sprposx), fix32ToInt(posy - camposy + sprposy), TILE_ATTR(PAL2, TRUE, FALSE, FALSE));
sprposx += FIX32(15);
SPR_initSprite(&sprites[9], &sonic_sprite, fix32ToInt(posx - camposx + sprposx), fix32ToInt(posy - camposy + sprposy), TILE_ATTR(PAL2, TRUE, FALSE, FALSE));
sprposx += FIX32(15);
SPR_initSprite(&sprites[10], &sonic_sprite, fix32ToInt(posx - camposx + sprposx), fix32ToInt(posy - camposy + sprposy), TILE_ATTR(PAL2, TRUE, FALSE, FALSE));
SPR_initSprite(&sprites[11], &sonic_sprite, fix32ToInt(posx - camposx + sprposx), fix32ToInt(posy - camposy), TILE_ATTR(PAL2, TRUE, FALSE, FALSE));
SPR_initSprite(&sprites[12], &sonic_sprite, fix32ToInt(posx - camposx + sprposx), fix32ToInt(posy - camposy ), TILE_ATTR(PAL2, TRUE, FALSE, FALSE));
sprposx += FIX32(15);
SPR_initSprite(&sprites[13], &sonic_sprite, fix32ToInt(posx - camposx + sprposx), fix32ToInt(posy - camposy ), TILE_ATTR(PAL2, TRUE, FALSE, FALSE));
sprposx += FIX32(15);
SPR_initSprite(&sprites[14], &sonic_sprite, fix32ToInt(posx - camposx + sprposx), fix32ToInt(posy - camposy ), TILE_ATTR(PAL2, TRUE, FALSE, FALSE));
sprposx += FIX32(15);
SPR_initSprite(&sprites[15], &sonic_sprite, fix32ToInt(posx - camposx + sprposx), fix32ToInt(posy - camposy ), TILE_ATTR(PAL2, TRUE, FALSE, FALSE));
sprposx += FIX32(15);
SPR_initSprite(&sprites[16], &sonic_sprite, fix32ToInt(posx - camposx + sprposx), fix32ToInt(posy - camposy ), TILE_ATTR(PAL2, TRUE, FALSE, FALSE));
sprposx += FIX32(15);
SPR_initSprite(&sprites[17], &sonic_sprite, fix32ToInt(posx - camposx + sprposx), fix32ToInt(posy - camposy ), TILE_ATTR(PAL2, TRUE, FALSE, FALSE));
sprposx += FIX32(15);
SPR_initSprite(&sprites[18], &sonic_sprite, fix32ToInt(posx - camposx + sprposx), fix32ToInt(posy - camposy + sprposy), TILE_ATTR(PAL2, TRUE, FALSE, FALSE));
sprposx += FIX32(15);
SPR_initSprite(&sprites[19], &sonic_sprite, fix32ToInt(posx - camposx + sprposx), fix32ToInt(posy - camposy + sprposy), TILE_ATTR(PAL2, TRUE, FALSE, FALSE));
SPR_update(sprites, 20);
while(TRUE)
{
handleInput();
// update sprites (only one to update here)
SPR_update(sprites, 20);
VDP_waitVSync();
}
regards.