1GAW: 2D Jump

As I said in the last post, I’ll be working on little bits of mechanics and features per week in order to get better. This week is basic 2D jump.

Name: 2D jump.
Example game: New Super Mario Bros.
Platform: Nintendo DS.


In its simplest form (no lateral movement), the player’s avatar jumps four times its lowest height and twice its super size. If the player jumps, and keeps the button pressed, the jump lasts for one second from the moment the avatar starts jumping until it touches the ground again, otherwise the jump is stopped and the avatar starts falling. Furthermore, the jump velocity is constant.


Given the behavior, I decided to use number variables (float) for storing jump speed, jump height (and its squared value) and three flags to know whether the avatar is grounded, jump-triggered and has jumped already.

For giving the feel I had on the game, I added a two-dimensional box collider component along with a two-dimensional rigid body component to the game object.  The rigid body component has all variables set to the default value except for the gravity scale, which is set to 3.

Finally, I set the theoretical jump height to 3.8 but don’t stop the movement drastically; I give it an 80-percent reduction, so the physics engine does the rest of the work for easing the movement. That gives the player a practical 4x-jump, plus extra help, which is good from a game design perspective.

As a matter of fact, after reaching a similar feel, I spent quite a lot of time tuning the variables.

This is the end result. You can jump clicking the game screen, pressing the space or the up-arrow keys on your keyboard.

[unity src=”182″]

No Comments Yet.

Leave a Reply