condition
compare two variables,
distance(zombie.x,zombie.y,player.x,player.y) >= 70
sub event 1 condition
if zombie.x < player.x
action1 zombie set not mirrored
action2 zombie set x to self.x+5
sub event 2 condition
if zombie.x > player.x
action 1 zombie set mirrored
action 2 zombie set x to self.x-5
that's it.
if you want to limit where the zombie stops,
you just compare the
if zombie.x > player.x + zombie.width*2
respectively
if zombie.x < player.x - zombie.width*2
the 2nd option would make the zombie stop at a distance from player of around zombie.width*2 or if your zombie width is 35 pixels then it will stop at 70 pixels distance from the player.x which is given by the player origin point so if your player has the origin point in middle then it will calculate from that, if your player origin point is to left or right you will face a bit of problems visually, cause logically its still 70pixels distance.
Thank you Corp,Plinkie and Davy. Appreciate all the help. Worked perfect and the code looks a lot cleaner.
I should be able to work out the rest.
But what is this? self.x-5. The zombies self minus 5 pixels on the horizontal? Not sure why this works.
Thanks again. :-)