#21784 - tornadokick - Sat Jun 05, 2004 2:11 am
I'm having some more trouble trying to start with programming the GBA. This time I'm trying mode 2. When I try getting my file to work, It just throws tiles (and sometimes partial tiles) around the screen (or, with some variations of the options, just displays nothing).
Everything compiles fine. frogmap (I'm recreating frogger) is the product of 5 tiles of 16x16 when run through GBAMapEditor. I ran the five tiles (a 16x80 256 color .bmp) through bmp2sprite.exe and exported roadtiles, giving me "roadtilesData" and "roadtilesPalette." The tutorial I'm using is the Pern Project. I've done extensive checking and experimenting to understand what is wrong. I'm now assuming that my mistake is due to my inexperience, and I am turning to better, more experienced sources.
Any help, suggestions, and comments are greatly appreciated. Thank you for your time.
Last edited by tornadokick on Wed Jun 09, 2004 9:38 pm; edited 1 time in total
Code: |
Bg bg1; int main(void) { u16 loop, x_loop, y_loop; SetMode( MODE_2 | OBJ_MAP_2D | OBJ_ENABLE ); //set mode ... // code dealing with sprites, not relavent 'cause sprites are working fine bg1.number = 1; // set up and give information about the background bg1.size = TEXTBG_SIZE_256x256; bg1.charBaseBlock = 0; bg1.screenBaseBlock = 24; bg1.colorMode = BG_COLOR_256; bg1.x_scroll = 120; bg1.y_scroll = 80; EnableBackground(&bg1); for(loop = 0; loop < 256; loop++) // load the palette of the tiles BGPaletteMem[loop] = roadtilesPalette[loop]; for(loop = 0; loop < ROADTILES_WIDTH * ROADTILES_HEIGHT /2 ; loop++) bg1.tileData[loop] = roadtilesData[loop]; // load the tiles into the Char Base Blocks u16* temp = (u16*)frogmap; for(loop = 0; loop < 64*64 /2 ; loop++) bg1.mapData[loop] = temp[loop]; // load the map into the screen base blocks // Program loop while(1) // don't end { .... UpdateBackground(&bg1); .... } return(0); } |
Everything compiles fine. frogmap (I'm recreating frogger) is the product of 5 tiles of 16x16 when run through GBAMapEditor. I ran the five tiles (a 16x80 256 color .bmp) through bmp2sprite.exe and exported roadtiles, giving me "roadtilesData" and "roadtilesPalette." The tutorial I'm using is the Pern Project. I've done extensive checking and experimenting to understand what is wrong. I'm now assuming that my mistake is due to my inexperience, and I am turning to better, more experienced sources.
Any help, suggestions, and comments are greatly appreciated. Thank you for your time.
Last edited by tornadokick on Wed Jun 09, 2004 9:38 pm; edited 1 time in total