Qbasicnews.com

Full Version: Gravity program
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Yea.... I made this hangtime calculator a while ago. I thought that someone might want to use my formulas, so I'm gonna release the source. All I did was use formulas, so you can edit it as you see fit easily. Here ya go.

Code:
DIM T AS INTEGER
CLS
PRINT "Hangtime Calculator"
PRINT "By: Dan Kogge"
INPUT "Velocity?(M/S) ", V
INPUT "Angle?(Degrees) ", A
A = A * (3.141592653589793# / 180)
T = 1
DO UNTIL V * (T / 100) * SIN(A) - 4.9 * (T / 100) ^ 2 < 0
X = V * (T / 100) * COS(A)
Y = V * (T / 100) * SIN(A) - 4.9 * (T / 100) ^ 2
IF Y > GY THEN GY = Y: GT = (T / 100)
T = T + 1
'PRINT X, Y, T
LOOP
TotT = T / 100 - .01
PRINT "Distance(M):", X
PRINT "Hangtime(Sec):", TotT
PRINT "Highest Point(M):", GY
PRINT "Time at Highest Point(Sec):", GT
Hehe, nice =P
Niceness...would be useful for like a pinball game or something Smile
Those formulas were very strange. They are adapted from some parametric formulas I found. They were designed for tracking vertical and horizontal distance in a zero-wind enviroment. I'm going to try to adapt them into a luner landing program, but I'm kinda swamped with work right now. My english teacher is a horrible excuse for life.
I've saved it.