#20979 - Miked0801 - Fri May 21, 2004 12:13 am
There's a few other threads about this, but in a nutshell, there are 2 basic ways to do this:
1. Every time the world position's X or Y value enters a new char value (newPos & (~0x07) != oldPos & (~0x07), redraw the entire map and reset the scroll registers.
2. Same check as above to see if a redraw is needed, but only fill in along the leading edge of the map and don't reset the scroll registers.
Advantages of method 1:
It's the simpler to code than method 2.
It frees up 34% of the VRAM that the Char LUT takes up as you will never leave a 31x21 area of VRAM.
Disadvantages of method 1:
You need to fill a lot more memory every time you want to scroll so it will run slower than method 2.
Advantages of method 2:
At worst filling in 52x2 bytes of RAM so it will run a lot faster if coded correctly.
It lends itself to dynamic char loading better than method 1.
Disadvantages of method 2:
It will take longer to get working.
While you can use the VRAM that is not being display, you must be very careful in doing so as it will be overwritten as the map scrolls around.
We use method 2 as we dynamically load chars here - though we used method 1 for the first 2 GBA projects we did due to its simpliciity and that it doesn't run too slow :)
#21027 - alek - Fri May 21, 2004 7:56 pm
in the tutorial section go to day 6 making the game
here go to
21) Scrolling both ways the not so easy way