VBGamer |
|
Well... Rag on a Stick (0 replies, 0 views) (2000-Aug-11) Depending on the size of your maps, doing the whole thing as one big tile isn't too memory efficent, but if you still want to go with it, then it isn't too hard.
Say your map is 1600x1200 pixels, it is on a surface called SurfaceMap
Work out what you want to have in the direct centre of the screen, say the coordinates (600, 400) then subtract half the size of the viewing area (viewing area being something like 800x600) giving you the coordinates of (200, 100)
because
600 - (800/2) = 200
and
400 - (600/2) = 100
Now at (0, 0) on the screen, blit SurfaceMap from (200, 100)-(200+799, 100+599) and you have the thing done, to move about (scroll), just recalculate everything like above with different coordinates for the centre of the screen.
hth |