How griffinm64/asteroids works
This is a small Pygame Asteroids game. The player controls a ship, the game loop updates and draws sprites, an asteroid field spawns asteroids, and shots can split them; colliding with the player ends the game. The shared circle base provides position, velocity, radius, and collision checks. Edges show only relationships visible in the excerpts; group updates and draws are dispatched by the main loop.
Main entry points: main.py Game loop · player.py Player ship · asteroid.py Asteroid · shot.py Shot
Components 8
Game runtime
- Game loop
main.py
Gameplay entities
- Asteroid field
asteroidfield.py - Player ship
player.py - Asteroid
asteroid.py - Shot
shot.py
Shared foundation
- Circle shape
circleshape.py - Game constants
constants.py
Other components
- Player
Connections 21
- Player → Game loop: quits game
main.py - Player → Player ship: controls
player.py - Game loop → Asteroid field: creates
main.py - Game loop → Player ship: creates
main.py - Game loop → Asteroid: updates and draws
main.py - Game loop → Player ship: updates and draws
main.py - Game loop → Shot: updates and draws
main.py - Game loop → Asteroid: checks collisions
main.py - Game loop → Player ship: checks collisions
main.py - Game loop → Shot: checks collisions
main.py - Game loop → Asteroid: splits on hit
main.py - Asteroid field → Asteroid: spawns
asteroidfield.py - Player ship → Shot: fires
player.py - Player ship → Circle shape: extends
player.py - Asteroid → Circle shape: extends
asteroid.py - Shot → Circle shape: extends
shot.py - Game loop → Game constants: reads settings
main.py - Asteroid field → Game constants: reads settings
asteroidfield.py - Player ship → Game constants: reads settings
player.py - Asteroid → Game constants: reads settings
asteroid.py - Shot → Game constants: reads settings
shot.py