A classic arcade-style asteroid game built with Python and Pygame. Navigate your ship, shoot asteroids, and survive as long as you can!
- Ship Control: Rotate and move your triangle-shaped spaceship
- Shooting: Fire bullets to destroy asteroids
- Asteroid Splitting: Larger asteroids break into smaller pieces when destroyed
- Collision Detection: Game ends when your ship collides with an asteroid
- Game Logging: Events and game state are logged for tracking gameplay
- Python 3.13+
- pygame 2.6.1
- Clone or download this repository
- Ensure you have Python 3.13 or higher installed
- Install dependencies:
pip install -r requirements.txtOr using uv:
uv syncRun the game with:
python main.py| Key | Action |
|---|---|
| W | Move forward |
| S | Move backward |
| A | Rotate left |
| D | Rotate right |
| SPACE | Shoot |
- Destroy all asteroids by shooting them
- Avoid colliding with asteroids
- Each asteroid destroyed by shooting splits into two smaller asteroids
- The game ends when your ship collides with an asteroid
- Asteroids: Appear randomly on the screen and move in various directions
- Splitting: When shot, asteroids split into smaller pieces (except for the smallest size)
- Shooting Cooldown: You can only shoot one bullet at a time with a brief cooldown between shots
- Screen Wrapping: Objects that move off-screen wrap around to the opposite side
main.py- Main game loop and event handlingplayer.py- Player ship class with movement and shooting logicasteroid.py- Asteroid class with collision and splitting behaviorasteroidfield.py- Spawns and manages asteroidsshot.py- Bullet/shot classcircleshape.py- Base class for circular entitiesconstants.py- Game constants and configurationlogger.py- Event and state logging system
See pyproject.toml for the complete list of dependencies.