Today…I give my first tutorial… This is where you can find nice, practical tutorials…But here, I have more time to answer your questions!
On with the tutorial.
Step 1~ Firstly, make an MC (Movie Clip) and call it “follower”. Give it the instance name of “follower”.
Step 2~ Then draw something pointing to the right… >>>
Step 3~ Make another MC and call it ”mouse”. Give it the instance name of “mouse”.
Step 4~ Draw a dot or something…I just drew a dot
Step 5 ~ Put this code inside the frame:
_______________________________________________________________
Mouse.hide();
delay= 10;
mouse.onEnterFrame = function() {
this._x = _root._xmouse;
this._y = _root._ymouse;
};
follower.onEnterFrame = function() {
dist_x = mouse._x-this._x;
dist_y = mouse._y-this._y;
distance = Math.sqrt(dist_x*dist_x+dist_y*dist_y);
angle = Math.atan2(dist_y, dist_x);
speed = distance/delay;
xspeed = speed*Math.cos(angle);
yspeed = speed*Math.sin(angle);
this._x += xspeed;
this._y += yspeed;
this._rotation = angle*180/Math.PI
};
______________________________________________________________
Any questions…Just leave a comment.
There you go! Please tell me what you made with this tutorial!
Email: birdview@live.com
EagleVision Productions
April 2, 2008 at 02:18 pm
Good, I may be using that in the near future !
April 2, 2008 at 02:19 pm
Thanks for visiting this blog!
I actually took this from Emanuele’s, but I explained it.