Skip to content

Latest commit

 

History

History
18 lines (11 loc) · 1001 Bytes

File metadata and controls

18 lines (11 loc) · 1001 Bytes

Gravity Simulator

Semi realistic gravity simulator using real physics equations for my AP CS Final Project.

Force of gravity between multiple objects is calculated using Fg = (G * m1 * m2)/r^2.

When two or more objects get too close, they collide and combine to form a bigger object and momentum is preserved. m1v1 + m2v2 = (m1+m2)*v’

Instructions:

Run the main function in "GravitySimulator"

All text fields take in integers. Play around with it to see what works well and allows you to achieve a stable orbit. Click anywhere on the “Gravity Simulator” to capture coordinates of the point and click “Pull Coordinates” to use them. Once you’re satisfied with your settings, click “Place” to place the body.

Game:

Try to see how many bodies you can get to maintain a stable orbit around a body at (550, 300) of mass 499.

Goal for the future:

Create a designated level maker and an official way to keep track of orbits as the game progresses. Potential scoring system.