Key need to be un-pressed and then re-pressed to do the assigned action again

Hello there ! :slight_smile:
I’m currently trying to make my keys a “pushable button” that you need to unpress to do the action a second time etc… (like a gameboy button for exemple)
How can I trigger that ?
I tried many ways etc… But I can’t figure it out…

Someone already made that ?

I’m not sure I understand. Did you try adding a trigger once? What are your events? My only other thought is something you’re doing needs to use an added Boolean variable and either toggle it or set it to true and false.

Hey, yeah there is a trigger once for each events, imma certainly try a boolean, maybe a timer should work too ?

If there’s a trigger once then I’m not sure what’s happening or not happening. Can you post a screenshot of the line(s) that’s not behaving in the way that you want it to?

Sure, but as I use finite state Machine, idk if there is a difference with ““regular code””

There is a lot of code, since it all my “jump part” that does not work like intended, bc when i keep space down, the animation of jump is still playin while on the floor

Is it always still set to the jump animation after jumping or just certain times? I can’t say that you have all the scenarios captured but you have to be close. The only one I didn’t see is an idle action for when the player is idle and space is pressed. Something to trigger when the player lands.

Maybe something tied to the falling Boolean

Maybe the idle section needs something like

Boolean value of global variable jump is false
if space is pressed
if player in on floor
if player is not moving
trigger once

then change the animation to an idle one maybe based on your direction variable.

It’s mroe complex than that, unfortunatly I cant screenshot all of the events assiociated because it will be a long long time since “Space” is in almost every events of every movements for transitions.
At least I could try using a timer for the jump key, but It will not resolve the entire problem, since I wouldnt be able to control the jump high when jumping (fun fact : i cannot even now lol)

Maybe the boolean Value could do something but Do i need to repeat it in every player states ?
I’m a bit confuse x)

I can’t answer that. It depends on where the issue is. You just need to trace each possible path. Maybe make a flowchart or truth table. IDK. I wish I could help.

The issues is, I think, related to the Space key that can be hold for continuing playing the animation, that’s why I want to “Patch” this by adding a “function” to act like a Gameboy button, that you need to un-press and press again to re-do the action ^^
I should try make my own inputs, maybe it could be easier, with all the informations and ideas you gave to me

Use boolean, key press and key release.

When X button is pressed + xButtonActive= true + trigger once then do stuff and also set xButtonActive= false.

When X button is released + trigger once then set xButtonActive= true.

Hello, thanks for your answer,
Do you have a visual of what you wrote ? Because i’m not sure to understand the structure ^^
Like maybe doing thoses evnts in gdevelop so i can see

Something like this:

Nice ! thx imma try and i’ll tell you

So it does not seem to work for me…

I’m showing you my current events so you can see how I builded it !

In the “transition” comment, you have all of my events related to the jump and returning to some others states (idle, run etc…)