#76101 - gs2phateon - Sat Mar 18, 2006 4:42 am
I've had this problem that's driving me absolutely crazy. I have this formula that I'm using to scroll a background map:
Where vscroll and hscroll are the number of tiles scrolled down and right (respectively), and bg0map2 is the location of the ScreenBaseBlock of the map (25 in this case). The 600 you see is the width of the map, in tiles. This formula has worked pretty well (it's glitchy because it doesn't use DMA, but I'll save that for later...) at scrolling a large 600x40 tile map.
My problem started when I tried applying all of the EXACT same elements to another program. For some reason, the tiles on the screen are in the wrong order, and it looks like a random mosaic than the original picture. I think something is wrong with the tiles, as well. Both programs used screen mode 0 and are on background 0.
The only major difference between the good and bad programs is that the bad one uses sprites. Does this have any effect on how the map and tiles are stored? If not, do you have any suggestions about what I might be doing wrong? I even tried replacing the source code of the second program (the one with the sprites) using the code from the working program (the one without the sprites), and the problem still happened.
There is one exception I have found to this: the original background I used to test the sprite program DOES still work, and was compatible with the scrolling. It is a small, 32x32 tile map (same as the background size), and doesn't use a lot of tiles. However, the larger maps I made have had this map/tile problem.
I'm sorry this might be difficult to describe, but any help you might have to offer would be very appreciated.
Code: |
for (b = vscroll; b < vscroll + 31; b++){
for (a = hscroll; a < hscroll + 32; a++){ *bg0map2 = testlevel2b_Map[(b * 600) + a]; bg0map2++; } } |
Where vscroll and hscroll are the number of tiles scrolled down and right (respectively), and bg0map2 is the location of the ScreenBaseBlock of the map (25 in this case). The 600 you see is the width of the map, in tiles. This formula has worked pretty well (it's glitchy because it doesn't use DMA, but I'll save that for later...) at scrolling a large 600x40 tile map.
My problem started when I tried applying all of the EXACT same elements to another program. For some reason, the tiles on the screen are in the wrong order, and it looks like a random mosaic than the original picture. I think something is wrong with the tiles, as well. Both programs used screen mode 0 and are on background 0.
The only major difference between the good and bad programs is that the bad one uses sprites. Does this have any effect on how the map and tiles are stored? If not, do you have any suggestions about what I might be doing wrong? I even tried replacing the source code of the second program (the one with the sprites) using the code from the working program (the one without the sprites), and the problem still happened.
There is one exception I have found to this: the original background I used to test the sprite program DOES still work, and was compatible with the scrolling. It is a small, 32x32 tile map (same as the background size), and doesn't use a lot of tiles. However, the larger maps I made have had this map/tile problem.
I'm sorry this might be difficult to describe, but any help you might have to offer would be very appreciated.