# Vertical Camera Movement in a 2D Platformer

I would like to ask about how vertical camera movement should be handled in a platformer in which the player changes his Y position frequently. For the past two days I've tried to adjust the camera movement and I haven't made any satisfying progress.

In principle, the camera's height should change as infrequently as possible, to avoid causing nausea. It also has to react quickly enough to the player's change in direction so he could see where he's going. An example of vertical camera movement done very, very well is in Rayman: Origins or Rayman: Legends.

How did you think vertical camera movement should be done in a platformer?

Some games define rectangular area of the screen that the player can move about in without causing camera movement. Any movement outside of this area will cause the camera to move to compensate. This allows the player to make small movements (e.g. adjusting position on a block or jumping on an enemy) without shifting the camera. Shaun Inman has posted a great demonstration of this technique at mimeoverse.com.

Some other games have several camera states that can be invoked as needed. As an example Super Mario World has at least the following vertical camera movement modes:

• Follow along the bottom of the level (typical)
• Follow along the top of the level (invoked in some cave levels)
• Follow mario (flying, swimming, climbing)
• Snap to platform when landing (used in vertically oriented jumping levels)

A great explanation of this technique as a demonstrated by SMW is has been posted (also by Shaun) on youtube.

The transitions between these modes can add additional complexity. Of course when done right the player will be unaware that anything special is happening behind the scenes. However this complexity can cause problems as demonstrated at about 3:35 in the second video.

I call the way I do it the rule of the two thirds.

Basically the screen height is split in three, and level design is done accordingly to these part sizes. Player avatar is always in the middle part. When she jumps to a higher platform contained in the top third of the screen, the camera moves to center the player. When player reaches the lowest part the camera moves down to center on the avatar. The only exception is when the player has reached the bottom of the level. It's the only moment when the camera is not moved to put the avatar in the middle part.

As the levels have been thought and designed with this method in mind camera shakes are not numerous enough to disturb players.

Note that the method used is very relative to the kind of gameplay you propose as well as the design of your game. That said this method may not be the most interesting one for your game.

The other technique that can be combined twith this one is working on camera zoom to perform even more subtle transitions.

I hope it helps.

EDIT: also, as this method is based on third size of your screen, the camera movement can be smooth enough to be discrete.