A classic arcade-style Asteroids game implemented in Python using Pygame.
In this game, you control a spaceship navigating through an asteroid field. Your objective is to survive as long as possible by avoiding collisions with asteroids and shooting them to clear your path.
- Player-controlled spaceship with rotation and thrust mechanics
- Shooting mechanism to destroy asteroids
- Asteroid splitting system:
- Large asteroids split into two medium asteroids when shot
- Medium asteroids split into two small asteroids when shot
- Small asteroids disappear when shot
- Randomly generated asteroid field with increasing difficulty
- Physics-based movement and collision detection
- A/D: Rotate the spaceship left and right
- W/S: Move forward and back
- Space Bar: Fire bullets
- Python 3.x
- Pygame
- Ensure you have Python installed on your system
- Install Pygame:
pip install pygame
Navigate to the game directory and run:
python main.py
- main.py: Main game loop and collision detection
- player.py: Player spaceship class
- asteroid.py: Asteroid class with splitting functionality
- shot.py: Bullet class
- circleshape.py: Base class for circular objects
- constants.py: Game constants and settings
- asteroidfield.py: Handles asteroid generation
When a bullet hits an asteroid:
- Large asteroids split into two medium-sized asteroids
- Medium asteroids split into two small asteroids
- Small asteroids are destroyed without splitting
The new asteroids move in different directions at increased speeds, making the game progressively more challenging as you destroy larger asteroids.