Player state jump trigger once not working?

hi I have a problem that I can’t work out. I’m using the advanced platformer extension and have basic player states. everything works but the jump key won’t trigger once when the key is held keeps jumping when on floor?

event states




Have you got a line cut off the top event in the jump screen shot? Or is it really just a trigger once condition on it’s own?

hi, just a trigger once condition on it’s own.

I suspect it’s because the game follows the following logic:

  1. animation is idle & player presses ‘z’ >> animation set to jump
  2. animation is jump & player is falling >> animation set to falling
  3. animation is falling & player is on floor (no left or right key pressed) >> animation set to idle
  4. goto 1.

And I wonder if the reason it keeps going is because the z key pressed hasn’t been checked for quite a few frames that the trigger once resets itself.

You could add a boolean object variable to flag that the z key was pressed and hasn’t been released yet?

thanks for replying. I did manage to get trigger once working when jumping from idle state but when jumping from run state and key is held the player keeps jumping. in the gdevelop wiki fsm tutorial example pressing the jump key also keeps jumping when held. UPDATE I went back to fsm animation states and moved the jump key press event outside of idle/run states THEN trigger once works for jump :open_mouth:

1 Like

I solved the problem! turns out I had the trigger once in the wrong position below key pressed when it need to be above key pressed.

working placement of trigger once for jump state

I placed the trigger once below the key press for all the states and now trigger once works.