AMOS TOME Series IV Manual Index | 12 |
Scrolling is a bit of an art form, in that there is never a perfect way of scrolling a screen, merely a lot of different ways, each with its own advantages and disadvantages. I could write forever about the trade offs and differences between software scrolling (using screen copy) and hardware scrolling (using screen offset), but I won't !
From the point of view of the beginner (and because of the memory saving, from the advanced user also), software scrolling is easier to use, and to understand. It is also more memory efficient, which is the whole point of TOME !
We can achieve scrolling by copying one section of the screen to another. For instance, if you wanted to scroll the screen left by a pixel, you would copy everything from 1 pixel in from the left, to the left of the screen, thus shifting it left.
Let's try an example:
Screen open 0,320,200,16,Lowres : Curs Off : Flash Off : Cls 0 Plot 319,100,1 Do Rem scroll 1 pixel left Screen Copy 0,1,0,320,200 To 0,0,0 Loop
Run this, and you will see the dot moving slowly to the left, leaving a trail behind it !
This trail is the "New" part of the scrolling area. Normally, we would replace this edge with some graphics, usually from a map. This is where the edge scrolling commands come in handy. Take a look at the Edge_Scrolling_Demo.Amos program for an example of this.
The Map Handle command is very powerful, and is specifically written for use in games which will scroll in 8 directions (i.e all over the place).
To use Map Handle, you have to arrange your screens very carefully. In an ideal situation, you should have a Double Buffered Screen (say screen 0) and a single buffered, but hidden screen (say screen 1).
You then set you Map View command so that the second X and Y co-ordinates give you 1 tiles width and height more than the area you are going to see. So if you wanted to display from 0,0 to 256,160 and were using 16x16 pixel tiles, you would have to set map view as 0,0 To 272,176. You will also have to make sure that the hidden, single buffered screen can handle this area.