A modern Python implementation of the classic Asteroids arcade game built with Pygame. Pilot your ship through an endless asteroid field, dodge incoming rocks, and blast them into smaller fragments before they destroy you.
This project was built as part of the Boot.dev Backend Development curriculum to practice object-oriented programming, game loops, collision detection, sprite management, and real-time game development using Python.
-
🎮 Smooth player movement and rotation
-
🔫 Shoot projectiles with cooldown mechanics
-
☄️ Procedurally spawning asteroids
-
💥 Asteroid splitting mechanics
-
🎯 Collision detection between:
- Player and asteroids
- Shots and asteroids
-
🧩 Object-oriented architecture
-
📦 Sprite groups for updating and rendering
-
📝 Event and game-state logging
-
⚡ Fixed 60 FPS game loop using delta time
Control your ship, avoid collisions, and survive as long as possible while destroying incoming asteroids.
| Key | Action |
|---|---|
| W | Move forward |
| S | Move backward |
| A | Rotate left |
| D | Rotate right |
| Space | Fire |
- Python 3
- Pygame
- uv
.
├── asteroids
│ ├── asteroid.py
│ ├── asteroidfield.py
│ ├── circleshape.py
│ ├── constants.py
│ ├── game_events.jsonl
│ ├── game_state.jsonl
│ ├── logger.py
│ ├── main.py
│ ├── player.py
│ ├── pyproject.toml
│ ├── README.md
│ ├── shot.py
│ └── uv.lock
├── LICENSE
└── README.md
git clone https://github.com/ikwukao/asteroids.git
cd asteroidsUsing uv:
uv syncLaunch the game with:
uv run mainA game window will open where you can fly your ship and destroy asteroids.
This project demonstrates:
- Object-Oriented Programming (OOP)
- Inheritance
- Encapsulation
- Polymorphism
- Sprite management
- Collision detection
- Delta time (frame-independent movement)
- Event-driven programming
- Game loop architecture
- Vector mathematics
- Modular project organization
Potential enhancements include:
- Score system
- Multiple lives
- Sound effects and background music
- Particle explosion effects
- Power-ups
- Animated sprites
- Start menu and pause menu
- High-score persistence
- Difficulty scaling
This project was developed while completing the Boot.dev Backend Development learning path.
Contributions, suggestions, and improvements are welcome.
- Fork the repository.
- Create a feature branch.
- Commit your changes.
- Open a Pull Request.
This project is licensed under the MIT License. See the LICENSE file for details.
Ikwuka Okoye
- GitHub: https://github.com/ikwukao