Tuesday, May 22, 2007

Project 6: eyes following the cursor



This code came from a tutorial and involved the use of trigonometry and flash's tan function. All frames containing the code and the movie clips were put into a single movie clip, so that there could be three instances of the eyeball watching critter on the stage.

The Code:

a = eye._y-_ymouse;
b = eye._x-_xmouse;
angleA = Math.atan2(a, b);
degrees = angleA/(Math.pi/180);
setProperty ("eye", _rotation, degrees);
setProperty ("eye2", _rotation, degrees);

No comments: