Jumping only once

Hey guys, I have a very strange issue when trying to make a platform game. I am using a Finite State Machine to have better control over the character. I want to make it so that when the player holds down the jump button, the character jumps only once and will not jump until the player has released the jump button and has pressed it again. So, I thought doing it with the “Trigger once” condition would work fine, but that doesn’t seem to be the case. Holding down the button still makes the character hop around!
Here are the isolated events used for jumping:


Can someone explain to me why this doesn’t work right, how exactly the “Trigger once” condition works and how can I make the character jumping only once?

Thanks!

1 Like

Trigger once doesn’t trigger only once, but once while the condition is true.

Yes, that is obvious, but doesn’t that mean it should trigger only once while the player has pressed the “z” key? Meaning that it would trigger again, once the player has released the key and has pressed it again? Since this is a sub-event, do any other overarching events influence this? Is it trigering because the State has been set to 0 again?

Well, as the state changed, I guess the trigger once became false so it resetted. Try doing it manually with variables and key released.

What is weird, however, is that I tried setting up a similar system to change some text in a text object and surprisingly enough, the condition works there as it should. Could this be, because of the Platform behaviour?