Search tutorials
Make one movie clip (be shure that the shape you draw in this movie clip is in 0 degrees)and then, put another inside it that will not be seen, now in this last movie clip write the next:
onClipEvent (enterFrame) {
z=_root._xmouse-_parent._x;
r=_root._ymouse-_parent._y;
_root.a=z;
_root.b=r;
}
onClipEvent (enterFrame) {
e=z/r;
k=Math.atan (e);
}
onClipEvent (enterFrame) {
g=k*180/Math.PI;
_rotation=g;
if (_root._ymouse>_parent._y) {
_parent._rotation=90-_rotation;
} else if (_root._ymouse<_parent._y) {
_parent._rotation=180-(_rotation-90);
}
}
With that, you can easily detect the mouse angle and copy the number of movie clips that you want. If you want the movie clip to go after the mouse too, write the next on the fist movie clip actions:
onClipEvent (enterFrame) {
g = _rotation*0.01745;
z = Math.cos(g);
n = Math.sin(g);
}
onClipEvent (enterFrame) {
_x += z*3;
_y += n*3;
}
That´s it...
| » Level Intermediate |
|
Added: 2002-12-01 Rating: 6 Votes: 26 |
| » Author |
| I like to make games wit easy action script |
| » Download |
| Download the files used in this tutorial. |
| Download (3 kb) |
| » Forums |
| More help? Search our boards for quick answers! |
-
You must have javascript enabled in order to post comments.


Comments
There are no comments yet. Be the first to comment!