Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm about to start developing a sidescrolling game where the players goal is to travel as far as he can in the horizontal axis before touching down. Note that I do not need to ever travel back on the horizontal axis.

I'm developing this with the AndEngine for android which uses opengl and box2d.

Before starting I need to decide on something important; should I use the world around the player to simulate movement or actually move the player and follow him with the camera features of the game engine?

Both approaches seems to have different strengths and fallbacks, so I don't know which one is considered best. For example, what would make it easier to add power ups along the way and have a nice animated background?


share|improve this question
Move the camera. – Jonathan Dickinson Jan 14 '12 at 19:31
Unless you have a specific reason for not wanting to use the camera (which has already been written for you), you should move the player and camera. Adding "power-ups" should not be affected either way. – Christopher Horenstein Jan 14 '12 at 20:41

Move the camera (attached to your player). I would imagine that your world has multiple objects such as enemies. If you went with moving the world, you would have to loop through all these objects to update their positions every time the world moved.

If you move the player, and attach the camera to the player then there is minimal resource usage. The game will get to its render phase, loop through everything once like it does every frame, and draw them at position - camera.position. Camera position would always equal your players position in this case.

share|improve this answer
Of course if the objects are enemies, you wouldn't have to loop through them, just add the worlds movement to theirs in their update method. – SirYakalot Jan 20 '12 at 17:11
+1. Use camera.setChaseEntity(player); to achieve this. – sm4 Jun 23 '13 at 9:14

It's pretty trivial really, it doesn't really make a difference from the things you've described.

Either you move the background past the camera and the player, or you move the player and the camera with him. I suppose there's one less thing to do if you just move the background.

Although I suppose if you move the background you'll have to parent any pickups and enemies to that, which again, is trivial but it's something to think about.

Personally I would move the player because I just like things to be done in a more realistic way.

share|improve this answer

I always move the camera and would recommend it - there are many reasons why I prefer this, but the most significant probably boils down to this:

  1. If you move the camera and player, that's only two entities that need to be updated to scroll the screen.

  2. If you move the entire world whenever the screen needs to scroll, that encompasses an unknown and possibly large number of entities that will have to be updated.

share|improve this answer
I do agree, but I would add that simply adding a line +='ing the worlds movement to the enemy class would be fairly trivial. – SirYakalot Jan 20 '12 at 17:10
@AsherEinhorn I suppose you're talking about a scenario such as a scene graph where each node shares the parent's transforms and simply moving the root node (i.e. the "world") would translate everything else automatically? Because in every other case, moving the world implies moving everything in the world - which was the point of my post. – David Gouveia Jan 21 '12 at 4:42
well if the world's movement is inversely proportional to the player. i.e - you move forward, world moves back, then you could just -= the players movement to all the gameobjects. I agree with you I'm just saying there are trivial ways to get both to work. – SirYakalot Jan 21 '12 at 10:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.