A classic Asteroids arcade game implementation using Python and Pygame.
This is a modern implementation of the classic Asteroids arcade game. Players control a spaceship and must destroy asteroids while avoiding collisions. The game features:
- Player-controlled spaceship with movement and shooting mechanics
- Procedurally generated asteroid field
- Collision detection between ship, asteroids, and shots
- Score tracking
- Smooth gameplay with 60 FPS
- Python 3.x
- Pygame 2.6.1
- Clone this repository
- Create a virtual environment (recommended):
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
-
Run the game:
python main.py
-
Controls:
- WASD keys to move the spaceship
- Space bar to shoot
- ESC or close window to quit
- The player's spaceship can rotate and move in any direction
- Asteroids split into smaller pieces when shot
- Collision with asteroids results in game over
- Smooth physics-based movement
- Classic arcade-style gameplay
main.py- Main game loop and initializationplayer.py- Player spaceship implementationasteroid.py- Asteroid class and behaviorasteroidfield.py- Asteroid field generation and managementshot.py- Projectile implementationcircleshape.py- Utility class for circular shapesconstants.py- Game constants and configuration
This project is open source and available for personal and educational use.