Enemy State/Animation

Hi Guys, Does anybody how to implement an ai…what I mean is…My ai is designed to follow the player and then when it gets to the specific distance the ai would shoot…I got that part working, but the problem is the animation, cause you see my enemy is flying so it has a fly and shoot animation, the problem is it will only execute the fly animation instead of the shoot animation when it is supposed to shoot… Thank you so much for your feedback,

DISCLAIMER:
This is my first time making a game so im a nub at it

Are you using the “Change the Animation” Action? Whatever Conditions you have to trigger the shooting, use that to change the animation as well. If you post a screenshot of your events we could help point you in the right direction.

Are you using a variable to hold the state of your enemy so it doesn’t switchs back to animation “Fly”? Like:
if Distace between char and enemy below 200 change Status = 1
if Status = 0 change animation to “Fly”
if Status = 1 change animation to “Shoot”
if Animation is Finished “Shoot” change Status = 0

or directly:
if Distace between char and enemy below 200 change Animation to “Shoot”
if Animation is Finished “Shoot” change Animation to “Fly”

Im using the second one, that’s maybe the reason why it’s not working,

Try using a non loop animation for “Shoot” and loop for “Fly” so it may look like:

 + if Distance between char and enemy below 200 change animation to "Shoot"
    Once when true.

 + if Animation is Finished "Shoot" change Animation to "Fly" 

I hope it helps

Thank you all so much for your help, this means a lot to me since I’m a beginner