Skip to content

Shramkoweb/asteroids

Repository files navigation

Asteroids

A minimalist clone of the classic Asteroids arcade game, built in Python with pygame.

Python pygame License: MIT

Features

  • Frame-rate-independent movement at 60 FPS
  • Asteroids spawn from screen edges and split into smaller fragments when shot
  • Shot cooldown and per-frame circle collision detection
  • JSONL state/event logger (game_state.jsonl, game_events.jsonl) for replay analysis

Requirements

  • Python 3.13+
  • uv for dependency management (recommended)

Install

git clone https://github.com/Shramkoweb/asteroids.git
cd asteroids
uv sync

Run

uv run python main.py

Controls

Key Action
W / S Thrust forward / back
A / D Rotate left / right
Space Shoot
Window close Quit

Colliding with an asteroid ends the game.

Project layout

.
├── main.py            # Game loop, sprite groups, collision dispatch
├── player.py          # Player ship: input, movement, shooting
├── asteroid.py        # Asteroid sprite and splitting logic
├── asteroidfield.py   # Timed asteroid spawner at screen edges
├── shot.py            # Player projectile
├── circleshape.py     # Base class for circular sprites with collision
├── constants.py       # Tunable gameplay constants
└── logger.py          # JSONL state/event logger

Gameplay tuning lives in constants.py — screen size, player speed, spawn rate, asteroid radii, shot cooldown.

License

MIT © Serhii Shramko

About

A Python implementation of the classic Asteroids arcade game using the `pygame` library.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages