Search tutorials
1. Create a movie clip of a ball
2. Drag an instance of it to the stage and name the instance "ball"
3. Create a new layer and name this "actions"
4. Add the following script to first frame of the actions layer
function xcoord(vi,time){
return vi*Math.cos(80*3.14/180)*time;
}
function ycoord(vi,time){
return vi*Math.sin(80*3.14/180)*t-0.5*t*t;
}
initx=30;
inity=400;
v=30;
t=0;
n=0;
r=0;
ball.onEnterFrame=function(){
t++;
n++;
ball._x=initx+xcoord(v,t);
ball._y=inity-ycoord(v,t);
ball._rotation=t*30;
duplicateMovieClip(ball,"newball"+n,n);
eval("newball"+n)._alpha=ball._alpha/10;
if (ball._y>inity){
initx=ball._x;
t=0;
v*=0.7;
}
if (ball._x>=300){
removeMovieClip("newball"+r);
r++;
}
}
| » Level Intermediate |
|
Added: 2004-12-17 Rating: 5.33 Votes: 24 |
| » Author |
| I like physics and math a lot. I always to simulate some physical phenomena in flash as a hobbt. Here is one of my favorites. |
| » Download |
| Download the files used in this tutorial. |
| Download (4 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!