Here is a simple example of something I've used in some projects. It basically keeps a state of awareness for the enemy, and when changed to a different state, reacts appropriately.
Use WASD to move the player. When you get within 180 pixels, the enemy goes into an alert state. When you get within 90 pixels, the enemy turns and attacks the player.
I have another problem:
I try duplicating your enemy, BUT the distance event stays respective to THE ORIGINAL enemy.
As in, when I walk to the clone enemy, it won't trigger alert stage; However, when I walk to the original enemy, even the clone(Far away) come chasing.
Please help.. your previous post helps a lot!