You need to give the enemy 'states' which can be an instance variable. Based on the states you can set the animations but it is the state variable that is most important.
In a function :
Set enemy.state=idle
Wait 4 seconds
Set enemy.state=shoot
Wait 3.6 seconds
Set enemy.state=idle
Wait 1 seconds
Set enemy.state=patrol
---
Enemy on collision with player AND enemy.state=patrol
Set enemy.state=melee
---
On animation melee finished : run function
--
This becomes more than a small problem when you have more than one enemy in the level.