[Solved] GDevelop seems to only register keypresses once

So, I’m trying to have the value of a global variable be increased or decreased in accordance with keyboard input. I’ve set the variable to be increased by 10 when the S key is released and decreased by 10 when the W is released. However, GDevelop only seems to register any key being released once and then it never registers it again. If I launch the scene with the debugger I can clearly see the variable decrease from 100 (its default value) to 90 when S is pressed, but then I can press S over and over again until the cows come home and nothing happens. Am I doing something wrong?

This is what the events look like:

Please clarify how you check that the value does not change? I tried it and everything works for me:

Exactly the same way you do it there. In the debugger (and yes, I know I have to press “refresh” in the debugger to get the new values if that’s what you’re wondering). It works once, but then it’s never accepting any input again. I will try it in an empty project though and see if I can get it to work as well.

EDIT: I tried replicating it in an empty project and now nothing works, not even once. Guess I’ll be reinstalling GDevelop then.

EDIT 2: No change there either, I’m afraid.

Try adding an object of type Text to the scene and outputting the value to it:

That, for some reason, makes it work.

Have you tried running test projects that are in the engine? It might be worth trying and seeing the results. This is already an experiment.

Typically, the pressed event is used to handle pressing, and a Trigger once while true is added to fire once. You are using the released event, which means that the event will fire when the button is released and it only happens once.

Yes, you will be doing something wrong, but not in either of the two the events in the screen shot.

Here is a video of a very simple version of what you’re trying to do, and it works fine. So the issue is with some other event :


I found the problem, and it’s a real silly one. I’m not clicking back into the game properly again after I hit “refresh” in the debugger and thus it isn’t registering subsequent keypresses. Well, problem solved. Thanks for the help though. Can’t believe it was that simple.

1 Like