View Full Version : Arms follow cursor
jstick
12-20-2005, 11:13 AM
basically id like to know how to have arms on a top down character to move around his body and follow the cursor.
a little like stick arena.
thanks in advance.. and all help is greatful
onClipEvent (mouseMove) {
Xd =_root._xmouse-_x; //Get _x distance from gun to mouse
Yd =_root._ymouse-_y; //Get _y distance from gun to mouse
radAngle = Math.atan2(Yd, Xd); //Use atan2 to calculate the angle from gun to mouse
_rotation = int((radAngle*360 / (2*Math.PI))+90); //Use PI to calculate and set gun rotation
updateAfterEvent();
}
jstick
12-20-2005, 11:45 AM
cheers for your help man, but where should i use this code?
should i use it on a movieclip of arms in a new layer of the guy?
well just put it on the guy and he will face the mouse. For what ever reason if you put it in a mc thats in another mc it gets messed up.
jstick
12-21-2005, 02:51 PM
nah its okay now i got it working!! cheers man.
jstick
12-21-2005, 03:07 PM
*thumbs up for you*
Grunteh
12-21-2005, 03:10 PM
All of his posts were on this thread. :D
jstick
12-21-2005, 03:12 PM
all 4 posts.. yup hah
vBulletin® v3.7.3, Copyright ©2000-2010, Jelsoft Enterprises Ltd.