#93388 - iainprice - Tue Jul 18, 2006 10:33 pm
I have tried looking for the answers on the forum but I can't find them but please be kind if these questions are kinda obvious....
I have been using code from other demos for sprite handling but I canot seem to get the y coorinates to work....
[code]
sprites[0].x = 111<<8;
sprites[0].y = 98<<8;
[/code]
then later:
[code]
void updatespritepos(Sprite* sp)
{
int x = sp->x >> 8;
int y = sp->y >> 8;
sp->oam->attribute[1] &= 0xFE00;
sp->oam->attribute[1] |= (x & 0x01FF);
sp->oam->attribute[0] &= 0xFF00;
sp->oam->attribute[0] |= (y & 0x00FF);
}
[/code]
Another problem I have is that I am using kaleid to convert a 32*32 256 bmp to a mode 4 c file. But when I load it, it seems corrupt:
[code] for(i = 0; i < 256; i++)
{
SPRITE_PALETTE[i] = ball_pal[i];
SPRITE_PALETTE_SUB[i] = ball_pal[i];
}
for(i = 0; i< 32*16; i++)
{
SPRITE_GFX[i] = ball_gfx[i];
SPRITE_GFX_SUB[i] = ball_gfx[i];
}
[/code]
Any ideas?
I have been using code from other demos for sprite handling but I canot seem to get the y coorinates to work....
[code]
sprites[0].x = 111<<8;
sprites[0].y = 98<<8;
[/code]
then later:
[code]
void updatespritepos(Sprite* sp)
{
int x = sp->x >> 8;
int y = sp->y >> 8;
sp->oam->attribute[1] &= 0xFE00;
sp->oam->attribute[1] |= (x & 0x01FF);
sp->oam->attribute[0] &= 0xFF00;
sp->oam->attribute[0] |= (y & 0x00FF);
}
[/code]
Another problem I have is that I am using kaleid to convert a 32*32 256 bmp to a mode 4 c file. But when I load it, it seems corrupt:
[code] for(i = 0; i < 256; i++)
{
SPRITE_PALETTE[i] = ball_pal[i];
SPRITE_PALETTE_SUB[i] = ball_pal[i];
}
for(i = 0; i< 32*16; i++)
{
SPRITE_GFX[i] = ball_gfx[i];
SPRITE_GFX_SUB[i] = ball_gfx[i];
}
[/code]
Any ideas?