Platformer Enhancements - Wall Jumping

6
  • 154 favourites

Index

Stats

20,337 visits, 69,975 views

Tools

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

12. Now lets add our logic, for each of the sub conditions, let's add the following logic:

Player Platform Vector y - 500

This basically tells the game, that when all our conditions are true, take the player and move him up (Y axis) by 500. Notice that we say -500, this is because on the Y axis, negative numbers move us upwards. Also note that at this point we are reacting the same no matter which side the wall is on. We will address this later, for now I just want you to be able to get the basic feel for the wall jump. Do this for each of the wall testing events and your event sheet should now look like this:

13. Go ahead and run the project. Move your character (the block) with the arrow keys. When you jump against a wall, hit the up arrow again. You may notice that the character does not always jump up again. This is because we are testing for "is jumping" this means that it only works if the character is still moving upward. Basically they have not passed the mid point (apex) of their jump. The reason this happens is because the way the game works, is that once a character is passed the apex/mid point/highest point of their jump, they go from jumping to falling. So in order for our wall jump to work the way it is currently written, you have to hit jump again pretty quickly in order for it to work. I did it this way initially as this was the most obvious and also one of the most common ways I have seen other try to get this working. Also, notice that if you do hit it quickly enough, you can keep hitting it and basically get infinite (until you run out of wall) wall jumping. Neither of these are what we want. So now lets look at how we can tweak this.

14. Go back to your event sheet and lets make the most simple change, lets change the check for is jumping, to is falling. Stay with me on this, I am just going through the most common variations of this so that you can not only see each one in action, but be better able to decide which one works for your game. This time when we test notice that the wall jump only kicks in once your player is past the apex of their jump, basically they are on the downward end of it. This completely changes the feel of the wall jump. Once you make the change, your event sheet should now look like this:

15. Now that we have based our wall jump off of both the is jumping and is falling conditions, now we will do it the way I tend to use it in my games. For my case, I want the player to be able to wall jump at any point in their jump as long as they are next to a wall. Lets update our event to simply check if the player is NOT on the ground. Basically if they are in the air, and against a wall, let them jump again. Note that we have not fixed the "infinite wall jump" issue yet either, we will address that soon. In order to get the wall jump working the way I want, I am going to change the "is falling" event to an "is NOT on floor" event. Double click the "is falling" event on your event sheet, and change it to "is on floor". Notice that their is no option for NOT on floor. We can do this though by inverting the "is on floor" event. Once you create it, right click on the "is on floor" event, and choose invert from the menu. Your event sheet should now look like this:

  • 0 Comments

  • Order by
Want to leave a comment? Login or Register an account!