So basically I’ve been experimenting with Finite State Machines and External Events for a fighting game. Right now I’m trying to come up with a Stun State for the enemy. When I press a button, the player attacks. The attack animation creates a hitbox. When that hitbox collides with the enemy, I want them to go into the stunned animation, and wait 2 seconds.
Now, I put up a scene timer and a boolean scene value. By default it’s false. When the hitbox collides with the enemy, the boolean value becomes true. While it’s true, the scene timer starts, and when it reaches two seconds, I want the boolean value to go false again. And the enemy to go back to its idle state.
Thing is, when I run the game, I attack the enemy. It goes into the stunned animaiton. But after 2 seconds…it doesn’t go back. It’s just stuck like this. What could be going wrong?
I should mention that this is all an external event containing each state of the enemy. Every other piece of code has been turned off, except for this.