Just for the bouncing ball fans :) Ive added 5 lines of code to my prog to draw in 2 side walls and make the ball reflect of the ground and walls. Oh and I changed the force of gravity and the mass of the ball and the engine thrust to make the whole animation a bit quicker (I did NOT modify the phys routines at all)
Graphics 800,600,32,2 SetBuffer BackBuffer() ballx#=100 bally#=480 ballr=20 ballmass=1;this is in kg enginethrust=500 ;this is in newtons engineburntime = 1 ; this is in seconds flighttime#=0 ;this is the flight time of the rocket so we can keep track of how long the engines have been burning for ;velocity speed# = 0 ;this is not needed now ;angle angle# = 60 ; this is the angle that the engines fire at ;we are going to calculate this shortly yspeed# = 0 yacceleration# = 0 gravity# = -200; this is constant ;we are going to calculate this shortly xspeed# = 0 xacceleration = 0 ;now to calculate the initial x and y speeds based on the firing angle and the speed/velocity xspeed=speed * Cos(angle) yspeed=speed * Sin(angle) time=MilliSecs() ;stop the ball falling through the "floor" While ((Not KeyHit (1))) ;this is our loop time calculator oldtime=time time=MilliSecs() t#=Float((time-oldtime))/1000 ;add the looptime to flighttime so we know how long we have been flying flighttime=flighttime+t ;first of all we need to resolve the force of the engines working on the ball in the x and y directions xforce#=enginethrust * Cos (angle) yforce#=enginethrust * Sin (angle) ;now we need to work out the accelerations in the x and y directions (F=ma therefore a=F/m) xacceleration = xforce/ballmass yacceleration = yforce/ballmass ;not forgetting gravity yacceleration = yacceleration + gravity ;and finally lets not forget to turn the engines off after 5 seconds If flighttime > engineburntime Then enginethrust=0 ;this is just to show the time on the screen Text 10,10,"Program loop time = "+t+" seconds" Text 10,30,"xspeed = "+xspeed Text 10,50,"yspeed = "+yspeed Text 10,70,"Flight time = "+ flighttime Text 10,90,"Engine thrust = " + enginethrust Line 100,500,700,500 Line 100,500,100,100 Line 700,500,700,100 Oval ballx,bally,ballr,ballr ;we are going to accelerate the ball xspeed=xspeed + xacceleration * t ;changed this formula from gravity to acceleration because we worked out the actual acceleration in the y axis earlier yspeed=yspeed + yacceleration * t ;now we move the ball according to how much time has passed ballx=ballx+xspeed*t ;we are using -yspeed because the computer counts lines from top to bottom and we want the ball to travel up the scren not down it bally=bally-yspeed*t If bally>480 Then yspeed=-yspeed :bally=480 If ballx<100 Then xspeed=-xspeed :ballx=100 : angle=angle-180 If ballx>680 Then xspeed=-xspeed :ballx=680 : angle=angle-180 Flip Cls Wend WaitKey