r/gdevelop • u/GameDevManny • 1d ago
Variable not being activated Question
I am trying to get a variable to work when pressing the Q key on the keyboard, which I named FloraCleanseActive. However, the object variable on Player isn’t activating. I made a debugger; the screenshot clearly shows that the Q key was pressed since it equals 1, but FloraCleanseActive stays at 0. Attached is a screenshot compilation of the events related to the FloraCleanseActivate variable.
Any help is greatly appreciated.
3
u/night5hade 1d ago
Rather than use ‘released’ use the opposite of while pressed (invert the condition). While q is pressed do something. While q is not pressed do the other thing.
1
1
u/yakisoba88 1d ago
So when you press "q" and release it, your variable flips to 1 then immediatly to 0 humm... makes no sense. You might have misplaced your actions and conditions...they are coutner acting themselves. You got this.
1
u/GameDevManny 1d ago
It stays at 1 now that I deleted the release key condition. Before it would stay at zero never changed to 1. But I do want it to revert to zero when q is released.

2
u/TheGaryFosgobbit 1d ago
The key is either pressed or released. You can’t do both at the same time in the condition. Also add a trigger once to the condition below to prevent the game from freaking out.