Handling player/background movements in 2D games
- by lukeluke
Suppose you have your animated character controlled by the player and a 2D world (like the old 2D side-scrolling games). When the user press right on the keyboard, the background is moved to the right. If the path is always horizontal, this is simple to do (incrementation/decrementation of the x-coordinate).
But suppose that the path is instead a polygonal chain. My questions are:
How do you move the background?
How do you move the background if the game objects are managed with a physics engine like box2D?