onClipEvent (load) {
nx=_x
ny =_y
function moveFor(spd, xd, yd) {
myRadians = Math.atan2(yd-this._y, xd-this._x);
myDegrees = Math.round((myRadians*180/Math.PI));
//
this._rotation = myDegrees+90;
//
if (this._rotation>180) {
this._y += (spd*Math.cos(Math.PI/180*this._rotation))
;
this._x -= (spd*Math.sin(Math.PI/180*this._rotation))
;
} else {
this._y -= (spd*Math.cos(Math.PI/180*this._rotation))
;
this._x += (spd*Math.sin(Math.PI/180*this._rotation))
;
}
}
}
onClipEvent (mouseDown) {
nx = _root._xmouse;
ny = _root._ymouse;
}
onClipEvent (enterFrame) {
distance = Math.sqrt(((nx-_x)*(nx-_x))+((ny-_y)*(ny-_
y)));
if (distance<5) {
movefor(0, nx, ny);
} else {
moveFor(5, nx, ny);
}
}