Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Projectile Calculations

Author
Message
N3R0
14
Years of Service
User Offline
Joined: 11th May 2010
Location:
Posted: 31st Jul 2010 07:45



I am not sure whats wrong with this but I am getting and error and its bugging me. I want to use this to eventually build up to a 3d catapult simulation, I am going to go from this, to a graph, to a 2d simulation, and hopefully a 3d simulation.
=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 31st Jul 2010 12:07
You have missed a * out from your height calculation.

also you goto to calc: but once its worked out distanceAway# the program will end without priniting anything

mikewhl
14
Years of Service
User Offline
Joined: 19th Jul 2010
Location: Columbus,Ohio
Posted: 31st Jul 2010 16:41
I been working with DBP for a total of two weeks now. I got your program to work. DBP, must be easy to learn.

Compare your code to mine. You made the same mistake I made, forgot to wait at the end of your code. It was printing your answers, but then would close so fast you couldn't see them.

I have spent so much time watching tutorials and reading books the last two weeks, I think I will go insane trying to grasp programing!
Hope this helps!

[/code]
print "How hard did you throw it? (Please type an integer)"
input "", Vo#

wait 500
cls

print "At what angle did you throw it? (Please type and integer)"
input "", Theta#

wait 500
gosub Calc
cls

print "seconds to reach the top of its trajectory. ";toptime#;" "
print "The projectile reached a height of ";height#;" feet."
Print "Total time traveled is ";totalTime#;" seconds."
print "You threw it ";distanceAway#;" feet."
wait key
end


Calc:
Vox# = Vo# * COS(Theta#)
Voy# = Vo# * SIN(Theta#)
topTime# = (0.0 - Vo#) / (-9.8)
height# = (Vo#) * (topTime#) + (0.5) * (-9.8)*(topTime#)
totalTime# = topTime# * 2
distanceAway# = Vox# * topTime#
Return
[code]

some cool stuff someone else said here

Login to post a reply

Server time is: 2024-09-28 20:21:00
Your offset time is: 2024-09-28 20:21:00