creai un clip con all'interno un oggetto, poi nel primo frame metti questo
codice:
_x=10;
_y=200;
xspeed=Math.random()*60-30;
yspeed=Math.random()*60-30;
rightedge=550;
leftedge=0;
topedge=0;
bottomedge=400;
gravity=2;
drag=.98;
bounce=.9;
Nel secondo frame metti
codice:
_x=_x+xspeed;
if(_x+_width/2>rightedge){
_x=rightedge-_width/2;
xspeed=-xspeed*bounce;
}
if(_x-_width/2<leftedge){
_x=leftedge+_width/2;
xspeed=-xspeed*bounce;
}
_y=_y+yspeed;
if(_y+_height/2>bottomedge){
_y=bottomedge-_height/2;
yspeed=-yspeed*bounce;
}
if(_y-_height/2<topedge){
_y=topedge+_height/2;
yspeed=-yspeed*bounce;
}
yspeed=yspeed*drag+gravity;
xspeed=xspeed*drag;
E nel terzo frame metti