A modern implementation of the classic Asteroids arcade game built with Python and Pygame as part of my Boot.dev learning journey. While following the course, I also extended the project with several gameplay improvements and refactored parts of the code to make it cleaner and easier to maintain.
- Player movement and rotation
- Projectile shooting system
- Asteroid spawning and splitting
- Score system
- Lives system
- Player respawn
- Temporary invincibility after respawning
- Automatic removal of nearby asteroids after respawn
- Screen wrapping
- Clean, modular project structure
- Python 3
- Pygame
- Git
.
├── asteroid.py
├── asteroidfield.py
├── circleshape.py
├── constants.py
├── logger.py
├── main.py
├── player.py
├── shot.py
└── ...
Clone the repository:
git clone <repository-url>
cd <repository-folder>Create a virtual environment (recommended):
python -m venv .venvActivate the virtual environment.
source .venv/bin/activate.venv\Scripts\activateInstall the required dependency:
pip install pygameRun the game with:
python main.pyIf you are using uv, you can also run:
uv run main.py| Key | Action |
|---|---|
| W | Move Forward |
| S | Move Backward |
| A | Rotate Left |
| D | Rotate Right |
| Space | Shoot |
-
Destroy asteroids to earn points.
-
Each destroyed asteroid awards 10 points.
-
The player starts with 3 lives.
-
After losing a life, the player:
- Respawns at the center of the screen.
- Receives temporary invincibility.
- Clears nearby asteroids to avoid immediate collisions.
-
The game ends when all lives are lost.
This project is intended for learning and educational purposes.