Enemy attacks one by one

My enemy keeps on attacking so fast. I want my enemy to attack a little bit slow. For example, the enemy hits you and go back to its fighting stance then swing an attack again. Any ideas?

1 way would be to have the enemy play a certain (non-attack) animation after every attack, which is set to Loop End and is given the highest priority.

Another way could be to start a timer after every attack, and the enemy can only attack when the timer reaches a certain time.

Another way is to work with states (can combine with above). After every attack the enemy goes into another state, which has no logic bricks that allows it to attack. A delay sensor could send it back to the attack state after some time.

For scripting examples I wouldn’t know…

How do you set a timer?

I attached a simple blend file (2.49).

The cube has a Timer property set to 4.
Spacebar will make the cube play an IPO (going up) AND set the timer property to 0.
“space AND timer>4” in the Expression controller basically says that the cube only plays the IPO when the space Sensor is True (by pressing spacebar) AND the timer property is more than 4.

For more complex stuff you should perhaps use the state system


timer.blend (126 KB)