Skip to content

bileshg/PlanetSimulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

6 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŒ Planet Simulation

This Python project uses the pygame library to create a simple, yet visually interesting, simulation of a solar system, including the Sun and the four innermost planets: Mercury, Venus, Earth, and Mars.

Requirements

The application requires pygame. Install it via pip:

pip install pygame

Usage

Run the main.py script:

python main.py

Overview

The application consists of three classes: CelestialObject, Planet, and SolarSystem.

  • CelestialObject is the base class representing any celestial object (like the Sun or planets) in the solar system, with properties such as name, radius, color, mass, position, and velocity.
  • Planet is a subclass of CelestialObject, representing a planet orbiting around a parent star. It has additional properties, including the distance to the parent star and the path of its orbit.
  • SolarSystem is a class that encapsulates a whole solar system, including a central star and multiple planets.

The simulation involves calculating gravitational forces and updating positions of celestial objects, and drawing orbits for planets.

Acknowledgments

Thanks to TechWithTim for the inspiration and the tutorial on which this project is based.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages