Cancel Platform Jump on Key Release

Discuss game development design and post your game ideas

Post » Fri Oct 23, 2015 9:54 am

Every time I press the jump key, the character jumps as expected. However, the character continues to ascend even after the key has been released. Any way to fix this?
B
3
Posts: 5
Reputation: 185

Post » Wed Oct 28, 2015 7:13 pm

The way I do it is start with a low jump strength and when the jump button is pressed the players gravity gets set to something lower and when you release it you set the gravity higher. You can get a lot of control out of your jumps this way you just need to play with it a bit. You can also tie this into a jump sound effect where you use a longer or repeating sound effect and play it when the jump is pressed and stop it (use a sound tag) when you release the button.
B
34
S
15
G
1
Posts: 80
Reputation: 2,727

Post » Wed Oct 28, 2015 10:10 pm

You can also do this:

if button is [not] down && object.jumping
-> set object.vectorY = object.vectorY/2

This will, as long as your character is jumping, halve it's Y speed every tick.
B
20
S
8
G
4
Posts: 195
Reputation: 3,555


Return to Game Development, Design & Ideas

Who is online

Users browsing this forum: No registered users and 1 guest