2D view movement?

Blitz3D Forums/Blitz3D Beginners Area/2D view movement?

po(Posted 2003) [#1]
If you wanna make a 2D scroller, how do you make the 2C camera\view follow the thing you are controlling? Do you just move the background image?


Nebula(Posted 2003) [#2]
The method I mostly use is to use a cursor position for the scrolling map and one cursor position for the player.

If the player cursor moves one place then the scrolling map moves one step.

playercursorx = 20
mapcursorx = 0

The scrolling map is build from tiles (see blitzcoder) using data from an array. So if the player cursor is at 20,0 then the map cursor is at 20-5.

mapcursorx = playercursorx - 5

It can get a little complicated when using smooth scrolling and various other things.