|
-
the cheesy child
Eye and Mouse experiment
I am making one of those things where there's an eye and it is looking at where ever the mouse is.
the making the code isn't a problem...
here it is:
onEnterFrame = function(){
a1 = eye._y-_ymouse;
b1 = eye._x-_xmouse;
angleA1 = Math.atan2(a1, b1);
degrees = angleA1/(Math.PI/180);
setProperty ("eye", _rotation, degrees);
}
i have attempted heaps of times to make it so that instead of having instance names, i can put the code in the movieclip and i won't have to use any instance names.
the reason i want to do this is i will make a whole crowd follow the mouse with their eyes, possibly for the background of a game or even a big part of the game.
anyway if somebody could help me i would really appreciate it and stuff!!!
thank you to anybody who helps!!!
EDIT: wow i have already solved this problem.... look at my code and feel free to use it!
onClipEvent (enterFrame) {
a1 = this._y-_root._ymouse;
b1 = this._x-_root._xmouse;
angleA1 = Math.atan2(a1, b1);
degrees = angleA1/(Math.PI/180);
this._rotation = degrees;
}
you have to make an eye that is a normal circle and the eye has to be originally facing left in the movieclip.
Last edited by bounceboy; 03-28-2009 at 04:15 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|