enemy chase player only when player is near?

Hi guys im trying to figure out the best way to have an actor only follow another actor when they are within a short distance of one another.I know i can get an actor(lets say enemy) an enemy to follow the player from wherever by setting the enemy to move to the players X and Y but how would i go about postponing that for when the player is within a certain range of the enemy and leave the player alone if the player can get a certain distance away?If there's a template out of that or a youtube video i've overlooked that would be awesome but any help is really appreciated.
Thanks
THRSTN
Thanks
THRSTN
Comments
http://gamesalad.com/game/1804
and TSB a Video would be awesome.Your videos have helped me out tremendously .I sent you an message a couple of weeks ago about my first game "sideways Pinball" being out and i have a promo code for you. I didn't post any promo codes cause i didn't want guys like that rotstik guy leaving spiteful reviews without actually buying the game.If you want the code shoot me an email at thurstongames@gmail.com Hell Asymptoteell if you want one ill give you one too for answering my post and trying to help out so quickly.
Thanks guys
In the enemy do:
2 real attributes StartX and StartY
Do 2 change attributes: self.StartX to self.position.X same for Y
Then a constrain on the enemy like, game.distance to magnitude(game.HeroX-self,position.x,game.HeroY-self.positionY)
Then a rule:
If game.distance <200 (change 200 to your requirements)
Move to HeroX, HeroY
in the otherwise part of the rule do move to StartX, StartY.
This will attack Hero when hes less than 200 away or go back to his start position if not.
You also need to make 2 constrains on the Hero's X Y i called them HeroX and HeroY
Darren.
thanks Darren
Thanks. I will be using this somewhere.
Thanks everyone
thnx for the tutorial , i fallow all the steps , but the player 2 did not chase player 1
can you send to me a copy of the platform
my email
scusa83(at)gmail dot com
thanks man
i have sent to you my game
please can you help me
so put an otherwise there and stop the enemy, or do whatever you want
Calvin