Construct 2 has an amazing platform behavior, with automatic physics, jumping and keys. But how do you add a double jump.
Double jumps are always pretty cool in games and give you more options.
I will make a detailed tutorial about how to use the basics of construct 2 later, a little bit of knowledge of construct 2 is necessarily for this tutorial.
Make sure that the player can land on an object with the solid behavior! Give the player a boolean “Double_Jump. We need this later for the double jump to work. If you run the game now, the player should be able to run and jump as a normal platformer.
Adding the event sheet
Now go to the event sheet. First we must check if the player is in the air before he can double jump. Add the condition “platform – is on floor” to the player. Right click on this condition and click on invert because we only want to do this action when he is not on the floor.
Step 2 is to check if the player hasn’t doulbe jumped before. Here we are going to use the boolean we’ve added to the player. Add another condition to the one above “is boolean set” to the player. Right click on this condition and click invert because we only want the player to jump when the boolean is false.
The last step is to check if the player hits the up arrow again so add the condition “on key pressed – up arrow” to the keyboard.
If you’ve done everything right you should have something like this
Now we must add 2 actions to this event. First add the action “set boolean double_jump to true” to the player because we only want the player to do one double jump.
Next is the action that actually makes the player double jump. Add the action “platform – set vector y” to the player, fill in -500. It is important to add a negative number because else the player will go the other way.
This is what it must look like
Test the game and you should be able to double jump, but you can only double jump once because the boolean is not being set to false. To do this add a new condition “Platform – is on floor” to the player. Add the action “set Doulbe_Jump to false” and you have your doulbe jump completed.
Go ahead and add it to your game, I hope you liked my first tutorial