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.

2D All the way! / physics problems help me PLZ

Author
Message
gamestud 33
21
Years of Service
User Offline
Joined: 7th Apr 2005
Location: house in parker CO
Posted: 6th Jul 2005 13:50
plzzzz i need your help i am making a lunarlander game and i am trying to get my lander to move with the propper physics, gravity, momentum, etc... i have ask my aunts brother to help me this forth of july weekend and he gave me all the equations i need for the game. but i forgot how and where to put them in and what some mean. plzzzz help!

itallics = superscripts / subscripts. superscripts after cosine and sine. subscripts after variables. subscript o means old. so xo = old x value. t = time. y = y positiion on screen. x = x position on the screen. a = acceleration. theta means theta. v = volocity.

These are the equations:
1) ay = f/m * sine 60O - g
2) ax = f/m * cosine 60o
3) y = 1/2 (f/m * sine 60o - g) * t2 +voy * t +yO
4) x = 1/2 (f/m * cosine 60o) * t2 +vox * t +xO
5) vx = ay * t + vox
6) vy = ax * t + voy
7) 1/2 g * t2 + vo * t + 1/2fy/m * t2
8)x = vox * t + 1/2 * fx/m * t2

Do not worry about your difficulties in Mathematics. I can assure you mine are still greater.
-Albert Einstein
UnderLord
22
Years of Service
User Offline
Joined: 2nd Aug 2003
Location:
Posted: 7th Jul 2005 14:22 Edited at: 7th Jul 2005 14:26
Read a physic book or learn the terminology then it'll all make sense.

For a 2d game you do not need to make real physic's you can make it seem like real with a few simple lines of code for a 3d game it'd have to be all that math physic's stuff that you'd have to read up on to learn.

What these simple lines of code are i dunno for 2d if you want to bump into things its easy you can use a 3d circle square whatever and just use collision commands its not perfect but it'll work for friction and other things you'd just use the ANG value along with a few other things. Its easyer to immatate physic in 2d then 3d to me.

When we talk to god, we're praying. When god talks to us, we're schizophrenic.
Schizophrenic beats eating alone.
qwe
22
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 7th Jul 2005 17:20 Edited at: 7th Jul 2005 17:23
Quote: "These are the equations:
1) ay = f/m * sine 60O - g
2) ax = f/m * cosine 60o
3) y = 1/2 (f/m * sine 60o - g) * t2 +voy * t +yO
4) x = 1/2 (f/m * cosine 60o) * t2 +vox * t +xO
5) vx = ay * t + vox
6) vy = ax * t + voy
7) 1/2 g * t2 + vo * t + 1/2fy/m * t2
8)x = vox * t + 1/2 * fx/m * t2"


could you please tell us what each equation is trying to find

i assume 1 and 2 are finding the acceleration, 3 and 4 are finding the x/y position, 5 and 6 are finding the velocity

and do you need help implementing? try making some code first then ask when you get stuck

also look up basic physics on google and you'll see these equations explained

If you want anything DB related hosted, log in (with ws ftp or something) www.lysergium.net with username [email protected] and password public. you'll be directed to lysergium.net/public
pizzaman
22
Years of Service
User Offline
Joined: 18th Feb 2004
Location: Gateshead, UK
Posted: 8th Jul 2005 01:21 Edited at: 8th Jul 2005 01:25
Let me first say its a lot harder than it looks to make a game like this.I made a simple Lunar Lander game when I was starting out; which I unfortunately lost the code to; and it was quite a challenge. I think those equations are going a little too complex for what you need. All you need are the standard equations of motion and a simple force equation.

Equations of motion:



Force equation:



Also if a body is falling the loss of gravitational potentential energy is equal to the gain in kinetic energy therefore:



List of what the letters represent:



To start youy game you should make a sprite with its offset set as its centre. By doing this its rotation will be at its center. Also you need to retrieve the angle of the sprite after the player's movement. After this you need to set up all the forces to act on the player then add all the forces togeher. To do this you need to split each force into its horizontal and verticle components and add the horizontal parts together and the vertical components together. To get a horizontal or verticle component of a force you need to use sin and cos.

You should now have two forces a horizontal force and a verticle force. You need to then turn the forces into distances to add to the players ship, which is done by using the equations of motion linked in with the force equations. Then all you have to do is update the player's ship and your done.

gamestud 33
21
Years of Service
User Offline
Joined: 7th Apr 2005
Location: house in parker CO
Posted: 27th Jul 2005 14:23
thanks guys you all helped alot my game is comeing along now thanks to you.

Do not worry about your difficulties in Mathematics. I can assure you mine are still greater.
-Albert Einstein

Login to post a reply

Server time is: 2026-06-12 11:22:22
Your offset time is: 2026-06-12 11:22:22