A small clone of the classic Asteroids arcade game, built with Pygame as a way to learn game development fundamentals in Python.
This project was created while working through a guided course on Boot.dev.
- Player ship that can move and shoot
- Asteroids that drift through space
- Asteroids split into smaller, faster pieces when shot
- Basic collision detection between:
- Player and asteroids
- Shots and asteroids
- Simple event logging to a
game_events.jsonlfile (ignored in git)
- Python 3.10+ (or similar)
- Pygame
Clone the repository and change into the project directory:
git clone <your-repo-url>.git
cd <your-repo-name>If you use direnv, it will automatically activate the virtual environment for you (based on .envrc). Otherwise, you can create and activate a virtual environment manually on macOS:
python3 -m venv .venv
source .venv/bin/activateThen install dependencies (from pyproject.toml):
pip install .From the project root:
python3 main.pyUse the keyboard controls (as configured in player.py) to move and shoot.
.
├── asteroid.py # Asteroid logic (movement, splitting)
├── asteroidfield.py # Spawning and managing asteroids
├── circleshape.py # Base class for circular game objects
├── constants.py # Game configuration constants
├── logger.py # Simple event logging utilities
├── main.py # Game loop entry point
├── player.py # Player ship, movement, shooting
├── shot.py # Projectile logic
└── README.md
This project is focused on learning:
Pygame basics (display, timing, input handling) Simple physics and movement Collision detection Managing game objects and state Organizing a small Python game into modules