//Step - then step again yb=yb+vyb*dt; //vyb=vyb+g*dt; xb=xb+vxb*dt; Move(blueball,xb,yb); if((yb<-1)&(vyb<0)){ vyb=-.8*vyb; vxb=.8*vxb; }; if((yb>1)&(vyb>0)){ vyb=-.8*vyb; vxb=.8*vxb; }; if((xb<-1)&(vxb<0)){ vxb=-.8*vxb; vyb=.8*vyb; }; if((xb>1)&(vxb>0)){ vxb=-.8*vxb; vyb=.8*vyb; };
//Reset - runs just once xb=-1; yb=-1; vxb=5; vyb=6; g=-10; dt=.01;
//Use with Mouse - onClick, OnMouseover etc. vxb=10*(Math.random()-.5); vyb=10*(Math.random()-.5);