#20390 - tethered - Mon May 10, 2004 5:59 am
hello,
i've got a solid understanding of tile mode 0 and the text backgrounds and have decided to move on to sprites. i'm able to get a sprite to display on the screen but it doesn't appear as expected. i was hoping someone here could clarify why.
here's the source:
here's the array definition for the sprite:
any ideas?
thanks,
chuck
i've got a solid understanding of tile mode 0 and the text backgrounds and have decided to move on to sprites. i'm able to get a sprite to display on the screen but it doesn't appear as expected. i was hoping someone here could clarify why.
here's the source:
Code: |
#include "includes\gba.h"
#include "graphics\sprites.pal.c" #include "graphics\ship.raw.c" OAMEntry sprites[128]; int main(void) { u16 i; u16* temp; s16 x = 104, y = 64; // center of screen SetMode(MODE_0 | OBJ_ENABLE | OBJ_MAP_1D); // clear any sprite data from the screen for (i = 0; i < 128; i++) { sprites[i].attribute0 = 160; sprites[i].attribute1 = 240; sprites[i].attribute2 = 0; } // set sprite oam data sprites[0].attribute0 = COLOR_256 | SQUARE | y; sprites[0].attribute1 = SIZE_32 | x; sprites[0].attribute2 = 0; // load palette for (i = 0; i < 256; i++) OBJ_PaletteMem[i] = sprite_Palette[i]; // load sprite data for (i = 0; i < 512; i++) OBJ_Data[i] = ((u16*)ship_Tiles)[i]; // game loop while(1) { vsync(); // load oam data temp = (u16*)sprites; for (i = 0; i < 512; i++) OAM_Mem[i] = temp[i]; } return 0; } |
here's the array definition for the sprite:
Code: |
const unsigned char ship_Tiles[1024] = {
. . . } |
any ideas?
thanks,
chuck