In my game, I have a container that gives out items when struck by the player. Each container has a variable that set’s it’s capacity to a random number between two values, which determines how many goodies are inside.
When the container expels it’s stuff, it’s capacity variable reduces to 0. Afterwards, I have a setup with a timer that only unpauses when the capacity is 0 or less. After the timer goes for about 1 second, the container will be deleted.
(All the code is sandwiched between the yellow and red comments)
However, the timer refuses to work. In the shown setup, the container won’t delete at all, no matter how much time has elapsed. In a previous setup though, the containers would automatically delete before the player even opened them, meaning that the timer ignored the variable condition and started on it’s own.
So basically, what I’m trying to achieve is to have this timer setup delete the empty container after 1 second passes, while using as little code as possible (For efficiency and clean code).
Does anybody know what I’m doing incorrectly? Your assistance is greatly appreciated. ^^