Thank you!
Actually, the variable "state" will let you divide for many situations while playing the game.
In your game, state 1 is throwing, state 0 is idle, you can add state 2 to attack, state 3 to do something else.
You can tweak it to reach the result which you need.