I have the following code which detects the mouse angle, relative to a holder movie clip, and then makes the rotation of a “turret” movie clip follow the mouse. How can I adapt it for use with another movie clip in place of the mouse?
onClipEvent (mouseMove) {
x = this._xmouse;
y = this._ymouse*-1;
angle = Math.atan(y/x)/(Math.PI/180);
if (x<0) {
angle += 180;
}
if (x>=0 && y<0) {
angle += 360;
}
_root.turret._rotation = (angle*-1) + 90
}