i have this code
onClipEvent (enterFrame) {
if (_currentframe == 1) {
thisframe = 1;
} else {
thisframe = 0;
}
if (thisframe == 1) {
if (hamflat == 0) {
if (hamgas == 0) {
xdis = _x-_root.cuthbert_mc._x;
ydis = -1*(_y-_root.cuthbert_mc._y);
mangle = Math.atan2(ydis, xdis);
angle = mangle/Math.PI*180;
_rotation = -1*angle-90;
distance = Math.sqrt(xdis*xdis+ydis*ydis);
if (distance<resistance && distance>tooclose) {
this.gotoAndStop(2);
if (hamspeed<maxspeed) {
hamspeed += 5;
}
} else {
this.gotoAndStop(1);
}
hamspeed *= deccel;
xhamspeed = hamspeed*Math.sin(_rotation*(Math.PI/180));
yhamspeed = hamspeed*Math.cos(_rotation*(Math.PI/180));
_x += xhamspeed;
_y -= yhamspeed;
}
}
}
if(thisframe==1){
_alpha=100
} else {
_alpha=10
}
}
the code detects wether the player is too close, then chases them if they are. This is not the problem however. The movieclip the code is on is on all the frames, however i only need him on the 1st frame. The problem is that the code should only allow him to move on the first frame and when he’s not he cant move. Please please please can somebody point me in the right direction.:hugegrin: