I’m making a crappy little prototype game that has a little inventory that can pop up if a button is pressed, and I’m trying to do that by changing the position of the objects and changing the the button text from “^” to “⌄”. However whenever the button is pressed the objects don’t move, and the button text dosnt change at all.
I’m not entirely sure what the problem is, any help is apreciated.
That’s a common issue. Events are processed from top to bottom. The changes made by the event make the condition in the 2nd event true. So, both events get triggered and the first event is basically undone. I call it a domino effect or chain reaction.
The easiest fix is to use a boolean variable and toggle it’s state back and forth between true and false. Then create events for each state.
Say you have a boolean variable named ShowInventory. You could use.
Just add conditions to the appropriate states.
See also:
https://wiki.gdevelop.io/gdevelop5/tutorials/how-to-make-togglable-states-with-variables/#31-option-1-using-the-toggle-boolean-action
1 Like
ohh! thankyou so much, I wasnt even thinking about that.
1 Like