how do you make an enemy run away when you (main charachter) come into a certain distance.
the script i have so far is
onClipEvent (enterFrame) {
if (this._x<_root.MC._x && this._x > 0) {
_x -= 5;
}
if (this._x>_root.MC._x && this._x < 550) {
_x += 5;
}
if (this._y<_root.MC._y && this._y > 0) {
_y-= 5;
}
if (this._y>_root.MC._y && this._y < 400) {
_y += 5;
}
}
however, all the running things do is hide in a corner.
i want them to move around randomly until you come within a certian radius, then they move away from you with increasing speed.
thanks!