Platformer Enhancements - Double Jump

7

Index

Stats

14,470 visits, 38,485 views

Tools

Translations

This tutorial hasn't been translated.

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.

Published on 4 Feb, 2013. Last updated 19 Feb, 2019

Getting Started

1. First let's run the project so you can get familiar with the layout and the basic platform behavior. Action: Press F5 on your keyboard or hit the "Run Layout" button on the ribbon at the top of the screen (it will only show up if you are on the "Home" tab).

2. Return to Construct 2 and the first thing we need to do in order to create our double jump behavior is to be able to react when the user hits the jump button. Our player already has the Platform behavior assigned which means by default the left, right and up arrows are used for movement. Left and Right do what you would expect, the Up arrow allows you to jump. In order for us to do other things when the player hits the Up Arrow, we need to add the keyboard object to our game. Action: Double click the background of your layout (or right-click in the objects panel and choose Add New Object) and from the dialogue box that pops up choose keyboard and hit OK.

3. Now that we have added the keyboard object to our game, we want to create an event that checks to see if the Up Arrow has been pressed, and also if the player is already jumping. If we don't check to see if the player is already jumping, then our code will replace the standard jump behavior as well which is pointless. We only want our double jump logic to come into effect if the player has already jumped off the ground. The first step is to test if the player is already jumping. Action: Go to your event sheet and click "Add Event".

4. Action: In the dialogue window that comes up select the Player object and then click Next.

5. Action: In the Add Event window scroll down to the Platform section and choose the Is Jumping event and hit the "Done" button.

6. What the event we just added does is check to see if the character is currently jumping. The way events work, our logic will only run if the events we test for are true. So in this case, if the player is currently jumping, then the rest of our code will run. Otherwise if they are not jumping, nothing else will happen at this point.

  • 1 Comments

  • Order by
Want to leave a comment? Login or Register an account!
  • This is amazing, Thank you! This may help me with triggering the jump sound better. Right now my player can press jump and while in the air can continue to press jump and the sound will trigger. If I can trigger it on jump phase that would alleviate my issues I believe!