Jbolts1,
Note that 9.8m/sec squared, stands for the amount of
added acceleration each second, of an object towards the earth. To clarify, if an object is initially at a stand-still, once dropped, the first second of fall the object would have fallen aproximately 9.8 meters. The second, he would have fallen 29.4 meters.
Acceleration means that the rate is increasing, even as decceleration means that the rate is decreasing. As you should see above, at the second second of fall, the rate of acceleration has increased, and the distance fallen had doubled that of the distance fallen at the first second. So, each second the rate of fall is increased by one exponent. To assure you understand, then at three seconds the fall distance would be 58.8 meters, and the rate of fall would be 29.4m/sec.
So, we see that the rate of fall changes, and does not simply stay at a rate of 9.8m/sec every second of the fall.
Below is a code snippet of a cannonball shoot. It uses three main values. One, which is the vector(speed and direction) of the cannonball made by the cannon,
which stays constant until the ball comes to rest. And, two, which is the rate of fall downwards towards the ground. So, as the cannonball travels is constant path with a constant speed, as the acceleration of gravity on the ball is increasing. So, there are two forces acting upon the ball;cannon force and gravity.
In the program, first a new position of the ball, using the constant vector of the ball, is calculated. Then, using those new values, a newer position of the ball is calculated by adding the current distance of fall to the values last created. This program follows the laws of physics, closely. It also is fully executable. Just copy and paste the code into your editor and run it.
set display mode 800,600,32
sync on
sync rate 60
REM <<<<<<<<<<<< MAIN LOOP >>>>>>>>>>>>>
repeat
REM << prepare cannon angle and force
if focus = 0
REM << get angle between mouse and cannon point
angle# = atanfull(mousex() - 0,mousey() - 300)
if angle# < 0 then inc angle#,360
REM << increase and decrease cannon force
if rightkey() = 1 and c_force < 49 then inc c_force
if leftkey() = 1 and c_force > 0 then dec c_force
REM << use mouse to shoot ball from cannon
if mouseclick() = 1
REM << initialize variables
g_accel# = 0
x# = sin(angle#) * 10
y# = 300 + (cos(angle#) * 10)
b_startx# = x#
REM << switch focus to cannon in action
focus = 1
endif
endif
REM << make ball fly
if focus = 1
REM << modify constant vector of movement made by cannon
x# = x# + (sin(angle#) * c_force)
y# = y# + (cos(angle#) * c_force)
REM << accelerate ball downwards(gravity)sync rate = 60/sec;acceleration = 1.63/sync;total acceleration/sec = 9.78/sec
inc g_accel#,1.63
y# = y# + g_accel#
REM << on a horizontal plane, get distance from current to ball's x coord start location
b_xdist# = x# - b_startx#
REM << draw ball to screen
circle x#,y#,5
REM << reset game if ball goes out of right or bottom of screen
if x# > 805 or y# > 605 then focus = 0
endif
REM << draw force length bar
ink rgb(255,0,0),0
box 10,570,10 + c_force,580
REM << print force strength
text 65,565,"Force = " + str$(c_force)
REM << draw cannon
line 1,300,1 + (sin(angle#) * 10),300 + (cos(angle#) * 10)
REM << print cannon angle
ink rgb(255,255,255),0
text 150,565,"Cannon Angle = " + str$(angle#)
REM << print ball fly distance
text 350,565,"Ball Travel Distance = " + str$(b_xdist#)
REM << instructions
center text 400,0,"Press left and right arrows to increase the force of the cannon"
center text 400,15,"Use the mouse to rotate the cannon"
center text 400,30,"Press the left mouse button to fire the cannon"
sync
cls
until mouseclick() = 2
end
+NanoBrain+