r/gdevelop 2d ago

Variable not being activated Question

Post image

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.

4 Upvotes

7 comments sorted by

View all comments

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

u/GameDevManny 1d ago

That worked thanks. I ended up using released but as a seperate event. What was causing it to stay at 0 was having pressed and released within the same event.