#10810 - goro - Tue Sep 16, 2003 4:47 pm
Hi,
Thanks to Nessie & Tepples I have manage to learn about tile maps.
I'm using mode 0/16-color tiles and I want to update the map in memory (256x256 pixels)with I'm elements from the map array(2048x256pixels) created using MapEd095.
The first screen is displayed using :-
-That should give you an idea of how my map array is organised (output from MapEd095)
I suspect that my map updating code contains the error :-
Can anyone help me? (if you need me to post more code-just ask)
Thanks to Nessie & Tepples I have manage to learn about tile maps.
I'm using mode 0/16-color tiles and I want to update the map in memory (256x256 pixels)with I'm elements from the map array(2048x256pixels) created using MapEd095.
The first screen is displayed using :-
Code: |
for(loop = 0; loop <256; loop++)
BGPaletteMem[loop] = backgroundPalette[loop]; for(loop = 0; loop < 6880; loop++) //load tile image data bg1.tileData[loop] = bgTiles[loop]; //4128 //load the map image data DrawMap(); |
Code: |
void DrawMap()
{ u16 index1 = 0; u16 index2 = 0; u16 loop; u16 loop2; u16* temp = (u16*)map; for (loop = 0; loop < 32; loop++) { for (loop2 = 0; loop2 <32; loop2++) { bg1.mapData[index1+loop2] = temp[index2+loop2];//draw 32 tiles; } index1 += 32; index2 += 256; } } |
-That should give you an idea of how my map array is organised (output from MapEd095)
I suspect that my map updating code contains the error :-
Code: |
void DrawUpdate()
{ u16 index1 = 0; u16 index2 = 32; u16 loop; u16 loop2; u16* temp = (u16*)map; for (loop2 = 0; loop2 <32; loop2++) { bg1.mapData[index1+Counter] = temp[index2+Counter];//draw 32 tiles; index1 += 32; index2 += 256; } } |
Can anyone help me? (if you need me to post more code-just ask)