A simple clone of the classic Asteroids arcade game built with Pygame. Control your ship, avoid collisions, and shoot asteroids to survive!
- Player ship with rotation and movement
- Asteroids that spawn randomly from the screen edges
- Shooting mechanic with cooldown
- Asteroids split into smaller pieces when shot
- Basic collision detection and game over logic
- Clean object-oriented structure using Pygame's Sprite system
| Key | Action |
|---|---|
| W | Move forward |
| S | Move backward |
| A | Rotate left |
| D | Rotate right |
| Space | Shoot |
asteroids/
โโโ src/
โ โโโ main.py # Game loop and main logic
โ โโโ player.py # Player logic and drawing
โ โโโ asteroid.py # Asteroid behavior and splitting
โ โโโ asteroidfield.py # Spawning new asteroids
โ โโโ shot.py # Player bullets
โ โโโ circleshape.py # Base class for circular objects
โ โโโ constants.py # Game settings and constants
โโโ requirements.txt
โโโ README.mdClone the repository:
git clone https://github.com/heysmtk/asteroids.git
cd asteroidsCreate a virtual environment (optional but recommended):
python -m venv venv
source venv/bin/activateInstall dependencies:
pip install -r requirements.txtRun the game:
python -m src.main๐ก Make sure you're using Python 3.11+ and have Pygame installed.
- Add score tracking
- Implement player lives and respawn system
- Add sound effects and music
- Create a start menu and game over screen
MIT โ do whatever you want, just have fun ๐
- Made with โค๏ธ by @heysmtk
