hello well this code below and it seems be a good script but it doest seem to work. the enemy just stands still, can any one help?
[AS]action = “stand”;
dir = “r”;
atone = false;
attwo = false;
atthree = false;
heroat = false;
///////////////////////////////////////////////////////////
enemy.onEnterFrame = function() {
this.gotoAndStop(action+" "+dir);
xdi = enemy._x-hero._x;
ydi = enemy._y-hero._y;
di = (xdi+ydi)/2;
if (distance>200) {
if (xdi>=50 && heroat == false) {
atstyle = random(3);
if (atstyle == 1) {
atone = true;
action = “atone”;
dir = “r”;
} else {
if (atstyle == 2) {
attwo = true;
action = “attwo”;
dir = “r”;
} else {
if (atstyle == 3) {
atthree = true;
action = “atthree”;
dir = “r”;
}
}
}
}
}
};[/AS]
that is the main code which goes on the first frame