Yet another take on the classic Asteroids arcade game, built with Python and Pygame. Features animated sprites, multiple graphics modes, and a professional asset management system. Initiated as part of the Boot.dev Python Development Course, and expanded upon.
-
Three Graphics Modes: Switch between different visual styles on-the-fly
- Sprites Mode: Full animated asteroids with 16-frame sprite animations and custom ship sprite
- Basic Mode: Enhanced geometric shapes with chevron ship design and irregular polygon asteroids
- Minimal Mode: Clean wireframe graphics for classic arcade feel
-
Performance Optimized: Threaded asset preloading system eliminates frame drops
-
Dynamic Audio: Procedural sound generation with fallback audio system
-
Professional Structure: Modular codebase with proper separation of concerns
-
Beautiful Backgrounds: Randomly selected space imagery for immersive gameplay
- Arrow Keys / WASD: Move and rotate ship
- Spacebar: Shoot
- G: Cycle through graphics modes (Sprites → Basic → Minimal)
- B: Cycle through background images
- Animated asteroids with 16-frame rotation cycles
- Custom ship sprite with proper scaling and rotation
- Full visual effects and engine glow
- Chevron-shaped ship design
- Irregular 5-7 sided polygon asteroids
- Filled shapes with colored outlines
- Simple wireframe triangle ship
- Circle wireframe asteroids
- Clean, classic arcade aesthetic
- Ensure you have Python 3.12+ installed
- Install uv package manager if not already installed
- Clone this repository
- Run the game:
uv run python main.pyasteroids/
├── main.py # Main game loop and entry point
├── src/ # Source code modules
│ ├── entities/ # Game entities (Player, Asteroid, Shot)
│ ├── game/ # Game logic and constants
│ └── utils/ # Utilities (Asset Manager, Graphics Manager, etc.)
├── assets/ # Game assets
│ ├── asteroids/ # Sprite animations
│ ├── images/ # Background images
│ ├── ships/ # Ship sprites
│ └── sounds/ # Audio files
├── tests/ # Test files
└── tools/ # Development tools
This project uses various art assets from different sources:
-
Trifid Nebula (
Trifid_Nebula_by_Deddy_Dayag.jpg):- Created by Deddy Dayag
- Source: Wikipedia
- License: Creative Commons
-
Hubble Space Telescope Images (files starting with
heic):heic0411a.jpg,heic0910e.jpg,heic1105a.jpg,heic1819a.jpg- Source: NASA Hubble Space Telescope
- Credit: NASA/ESA
- Public Domain
-
AI Generated Space Scenes (files starting with
StockCake):StockCake-Celestial Aurora Majesty_1758665862.jpgStockCake-Celestial World Discovered_1758665899.jpgStockCake-Cosmic Asteroid Field_1758665834.jpgStockCake-Cosmic Debris Field_1758665951.jpgStockCake-Cosmic Rocks Adrift_1758665959.jpg- Source: StockCake.com
- AI Generated Images
- License: Public Domain
- Asteroid Sprites:
- Source: http://zimnox.com, via Reddit
- Various asteroid animations in large, medium, and small sizes
- Multiple variants (a1, a3, b1 series)
- Ship Sprite (
yct20hubfk061.png):- Source: Thunder246, via Reddit
- Used in sprites graphics mode
- Threaded preloading of all sprite animations
- Progress tracking with loading screen
- Intelligent caching to prevent runtime file I/O
- Support for multiple sprite variants and sizes
- Runtime switching between three distinct visual modes
- Mode-specific rendering pipelines
- Optimized drawing routines for each graphics style
- Proper sprite scaling and rotation handling
- Procedural sound generation for missing audio files
- Dynamic sound loading and caching
- Support for shoot, explosion, thrust, and collision sounds
The project uses a modern Python development setup:
- uv for package management and virtual environments
- pygame 2.6.1 for graphics and input handling
- Modular architecture for maintainability
- Professional project structure following Python best practices
This project is open source. Please respect the individual licenses of the art assets as listed above.
Special thanks to:
- Boot.dev for the base project
- Deddy Dayag for the beautiful Trifid Nebula image
- NASA/ESA Hubble Space Telescope team for the space imagery
- StockCake.com for the AI-generated cosmic scenes
- Zimnox.com for the asteroid sprite animations
- The Pygame community for the excellent game development framework