12. Now we have an event that check to see if the player is jumping, and if they are hitting the Up Arrow. We then set the players Y position to -500 which should give us a nice double jump effect. Next let's test our project. Action: Hit the F5 key to run the project. Attempt to double jump a few times. (Pay attention to when it works and when it does not) Your event sheet should look like this:
13. You may have noticed that when you attempt to double jump it does not always work. You may have also noticed that you are not limited to only a double jump, you can pretty much jump infinitely. Next we will address these two issues.
14. First lets look at why our double jump does not always seem to work. This is actually caused by the fact that we are basing our behavior on if the player "is Jumping". Is Jumping only counts if the player is currently on the upward portion of their jump. Basically they have not yet hit the apex or high point of their jump. This means that to double jump, you must hit the up arrow again before they hit the mid point of their jump. So next we will go back in and look at some other options to adjust the behavior. This will allow you to tweak the mechanics of the double jump to match your needs.
15. Action: Return to your event sheet and double click on the "Platform is Jumping" condition. In the window that comes up scroll down to the Platform section and notice that there is also an "is Falling" event. Double click "is Falling" to use it instead of the current is jumping event. Now test your project again.
16. Notice that when we use the is falling test, that we now can only use our double jump once we are on the downward portion or decent of our jump. While this may work for some people, I tend to prefer another route. To make the double jump more responsive, I like to allow the player to be able to use it during any portion of their jump. This gives them a much better feeling of control and also makes your game feel more responsive because it removes the uncertainty of the double jump working. Action: On your event sheet, change the "is Falling" test to "is on floor".
17. Action: On your new event (is on Floor), right click and choose the Invert Option. This will let us say we want the opposite of is on floor. Basically we are saying if the player is NOT on the floor. This can be a very useful tool for your logic tests.
18. You now have an event that test to see if the up arrow is pressed, and the player is currently NOT on the floor. This should be true whenever the player is in the air. Go ahead and test your project now, notice how much more responsive and predictable the behavior is now.
19. Now we have resolved our issue with the double jump feeling unpredictable and sometimes unresponsive. You can of course use any of the above mentioned ways to implement your behavior, but remember that it needs to make sense within the context of your game. Even more importantly, you need to understand that no matter how good your game looks, or how good the story is, if your game feels unresponsive or sluggish, you will lose your audience quickly. Gameplay is king at the end of the day. Beautiful graphics and effects won't help you if the gamers feel the gameplay is not responsive and are able to predictably move their characters through your world. Next lets look at fixing the issue with the infinite jumping.