I've been looking for a way to implement wall-jump in my xna game, but I can't find any information about it, can someone could someone please help me out ?


When a player collides with a wall while jumping (or, if you like, falling), turn on a flag for the next 100 milliseconds or so that causes an attempt to jump to successfully initiate a jump (ignoring any surface contact checks) with a fair amount of speed on the X axis in the direction away from the wall. Remember to turn the flag off early if a jump is in fact initiated.

  • 3
    \$\begingroup\$ I think you need to modify the first sentence: "When a player collides with a wall (while they are jumping)..." otherwise the player could wall jump from being stationary on the ground next to a wall, which wouldn't be expected. \$\endgroup\$ – CiscoIPPhone Feb 9 '11 at 13:09
  • \$\begingroup\$ @CiscoIPPhone: Yeah, thanks. That would produce an odd change of behavior between the 100 ms after collision and later. \$\endgroup\$ – chaos Feb 9 '11 at 15:27

I honestly would have just done a point check. So:

if (falling AND left_key_pressed AND !point_free(x-1,y))

You may want to change the y to say y + sprite_width/2 (or - depending on your coordinate system) so that it checks to the left of the middle your sprite instead of the top (or bottom). This is how N implements wall checks for wall jumping (last paragraph).

After that you must decide on how tight you want your wall jump. If the vertical velocity of your jump overcomes the horizontal before the player is able to reach that same wall again, you will not be able to wall jump up the same wall and will gradually fall back to the bottom (like in Mario games with wall jumping). If you do allow the horizontal to be weak enough for the player to get back to the wall, he/she will be able to progress up the wall (like in Meat Boy).

Another approach not mentioned is Super Metroid's. In that game when you are against a wall, if you move off that wall a very short "moving off wall" animation will play. If you jump during that animation, you will do a wall jump. (Super Metroid also allows a player to climb up a wall using wall jumps, but it requires a bit of skill (in fact everything about wall jumping in Super Metroid requires a fair bit of skill...).)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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