Hi everyone,
I am new to GDevelop and have been stuck for two full days on something that seems incredibly simple: making a chest open and close when you click it.
Here is what I want to do:
- Chest starts closed
- When the player clicks, it opens.
- When the player clicks again, it closes.
Here is the event summary (I tried both object and scene variable logic):
Conditions:
- Cursor/touch is on Chest
- Left mouse button is released
- Trigger once
- Chest.Variable(isOpen) is false
Actions:
- Set animation of Chest to 1
- Set Chest variable isOpen to true
Conditions:
- Cursor/touch is on Chest
- Left mouse button is released
- Trigger once
- Chest.Variable(isOpen) is true
Actions:
- Set animation of Chest to 0
- Set Chest variable isOpen to false
I also tried putting both into a single event with sub-events, and even used scene variables just in case object variables were bugged. I added debug actions and checked in the debugger: the variable isOpen changes to the second branch, whether it is closed or opened. And when I try to click again, nothing happens, it just stay on the second branch.
I have tried so many ways to write the event, nested, non-nested, triggers only once, scene variable, object variable. I am running out of options to try now.
It feels like I am misunderstanding how GDevelop handles animations and object variables. I would really appreciate if someone could look at my event structure and point out what’s wrong. I am determined to learn GDevelop, but this one issue is killing my motivation.
Thanks in advance.