I’m trying to make an input to be un-pressed and re-pressed to allow again a jump
Because for now, when I keep Space key down, it will jump again and again
But I can’t figure it out,
I tried variable and timers but it does not seem to work…
Here is my Idle To Jump Code :
And My Jump to Land Code :
I can’t figure it out… I added object variable + timer to see if the key is pressed or not etc… but it doesnt work, so I returned to my original code, maybe you can help me
Your solution does not work for me unfortunatly…
Oops, I had deleted the comment, but you saw it quickly! I checked again and the events caused the minimal jump. Sorry. If I can think of a solution I’ll present it here.
But just to clarify, don’t you want to disable the default Character Platform Behavior controls?
They already are disabled
Oh, ok. And where are the events simulating the jump? In your screenshots you only have the animation change.
It’s only this, I use a finite state machine
You need to implement “Can only jump once per press” logic in all of your states that allow for jumping.
A boolean variable that is toggled whenever you press the jump button, must be false (or true, your choice) as a condition to go to your jump state, and doesn’t revert back until you’re on the ground and the jump button is not pressed (as in “your jump button/key is pressed (inverted)”, not released, otherwise it’ll never toggle the first time).
You can see this in the FSM that is in the Not-A-Vania example, it is the “Can only jump once” groups in many of the states.
Note. If you’re doing variable jump height using jump sustatin, you’ll need to have another variable that is used to determine if a jump has started, and jump as long as the jump key is being pressed.
Here’s an example of that without an FSM, it also includes logic around coyote time.
Yes, this will mean you will need a set of extra events in most of your FSM states(The “canJump” variable events) as well as extra events in your jump state (the coyote time events, the Is jumping events, etc), and yes it will be required required.
Thanks for your response,
But i’m not sure I understood everythings…
Could you give me an exemple for a FSM ?