Computer Science Canada Gravity |
Author: | mitchenerjosh [ Tue Oct 02, 2007 6:22 pm ] |
Post subject: | Gravity |
I need some help... I was wondering if anyone new anyway to simulate gravity in Turing so that i can move say a square along a path but then it falls off when it reaches then end or something just really simple, I'm thinking of making a program like linerider, if you have any idea's please post.. THANKS! linerider: http://www.official-linerider.com/play.html |
Author: | Cervantes [ Tue Oct 02, 2007 7:06 pm ] |
Post subject: | RE:Gravity |
If you're object is moving along the ground, you can say that the force of gravity is just a constant force in the downwards direction. So, you've probably already got x and y coordinates defined for your object. Define vx and vy, the velocities in the x and y direction. Then every time through the loop, subtract some constant amount (application of gravity here) from vy. You'd also have to apply the normal force, which will completely cancel the gravitational force if the object is sitting on a flat object. You might be able to get away with simply not applying the gravity force if the object is sitting on another (horizontal) object. |
Author: | mitchenerjosh [ Fri Oct 19, 2007 1:10 pm ] |
Post subject: | RE:Gravity |
could you please post some example code for me to test out and understand, i am having trouble with this. |
Author: | Cervantes [ Fri Oct 19, 2007 4:35 pm ] | ||
Post subject: | Re: Gravity | ||
Here's some pseudocode:
|