Qbasicnews.com

Full Version: Projectile trajectory
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i need to find the formula for Projectile trajectory,
i want to make a game like scotched earth.
i have been looking on line for it ofr a while but i am drawing
a total blank!
can any one help?
oh im using angle and power, for the game input!
i will also use gravity changing consepts! but for now i know its 9.8
I am sure that some one will come along and post the info you're looking for, but in the mean time, check out wikipedia.org. Between google and wikipedia, finding information like this is almost trivial if you're willing to read two or three pages, and since wikipedia is massively cross referenced, anything you don't understand at first glance is easy to look up.

With that said, (and pardon the soap box), stop for a moment and reconsider the impetus of your question.
You want to make a scorched earth clone, which mean your goal is an interactive program that displays an animation of some object being hurled across the screen. Restated, you want to use a sequence of images to evoke the idea of a moving object. You can picture this in your mind. You've seen things thrown through the air millions of times. You know what it should look like. Now, I assume to know how to display an image on the screen in various different positions. I also assume you've played around with "moving" an object around, so you have some idea of the variables involved. Now think about what you already know about a moving object (gravity pulls thing down, not up or side ways; while moving up, things slow down in the upward direction; while moving down, things speed up in the downward direction) and think about these things in terms of the kinds of variables you've used before.
Then just go code. Start simple and then add details. You'll know instantly if it doesn't look quite right when you run your code, and sometimes merely seeing how it isn't "right" is enough to understand how to fix it.

Here's my point. You're the programmer. You get to decide whether or not you want to "recreate" reality or just simulated it. You don't HAVE to adhere to one particular view of physics. You can come up with your own physics, and if it looks right, then pragmatically... it is right.

Don't get me wrong. There comes a point where you simply don't want to reinvent the wheel. You could go and learn about vectors and trigonometry, or you could model your game with a few differential equations, and that would fine. It would be great, but not because it would make your game more life like. Rather, it would add to your bag of tricks and give you a few more ways to tackled problems, but when it comes down to it, merely implementing a solution will never give you a new idea. For that, you have to take the time to solve a problem. Trust me, no matter how great your game turns out, you'll never have as much fun playing it as you will coding it, so take some time to work at it before rushing out to see what everyone else has done.
On wikipedia, I found this page...

http://en.wikipedia.org/wiki/Trajectory_of_a_projectile

You are asking for us to teach you physics, and that is a difficult subject. This should help. Good luck!
thanx alot Torahteen!
Hey, no problem man. Glad I could help. Big Grin