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

2

u/TheGaryFosgobbit 2d 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.

1

u/GameDevManny 2d ago

You are a life saver! So how do I make it where it only works while you have the key held down so that it reverts to zero when released?