Free ActionScript

Flash AS2 & AS3 Tutorials, Game Code, Effects, Source Files & Sample Downloads

Game Enemy AI – Follow Player


Flash ActionScript 2 game enemy AI. This script gives your enemies the ability to follow the player.

Download Fla Sample

Download Fla Sample

Customizable Enemy Settings

  • movement speed
  • turn rate
  • aggression range

Check out the updated version of this script that incorporates different enemy behaviors in to one function, as well as creating multiple enemies at the same time: Enemy Behavior – Run Away & Follow Player

5 Responses

I really found this fla useful but I’m a little stuck. I want to make more than one of these enemies but when I do that, only one of them follows. I am duplicating the enemy and putting it on stage at random.

  • Hi Werty2334, upload your fla somewhere, I’ll take a look.

  • I could use another one of these which explains how to get more than one too, it all works perfectly up-til you want more than one… could the enemy code be put in his own movieclip? thats what i was using before but now i want him to point at me too.

    Thanks in advance

  • There’s a good article on how AI works on

    It’s not specific in detail for Flash, but gives you a good theory on how it works for any beginner games programmers out there.


  • Leave a Reply

    You must be logged in to post a comment.