Skip to content

Rhettica/asteroids_game

Repository files navigation

Asteroids in Pygame

A small clone of the classic Asteroids arcade game, built with Pygame as a way to learn game development fundamentals in Python.

This project was created while working through a guided course on Boot.dev.

Features

  • Player ship that can move and shoot
  • Asteroids that drift through space
  • Asteroids split into smaller, faster pieces when shot
  • Basic collision detection between:
    • Player and asteroids
    • Shots and asteroids
  • Simple event logging to a game_events.jsonl file (ignored in git)

Requirements

  • Python 3.10+ (or similar)
  • Pygame

Installation

Clone the repository and change into the project directory:

git clone <your-repo-url>.git
cd <your-repo-name>

If you use direnv, it will automatically activate the virtual environment for you (based on .envrc). Otherwise, you can create and activate a virtual environment manually on macOS:

python3 -m venv .venv
source .venv/bin/activate

Then install dependencies (from pyproject.toml):

pip install .

Running the Game

From the project root:

python3 main.py

Use the keyboard controls (as configured in player.py) to move and shoot.

Project Structure

.
├── asteroid.py        # Asteroid logic (movement, splitting)
├── asteroidfield.py   # Spawning and managing asteroids
├── circleshape.py     # Base class for circular game objects
├── constants.py       # Game configuration constants
├── logger.py          # Simple event logging utilities
├── main.py            # Game loop entry point
├── player.py          # Player ship, movement, shooting
├── shot.py            # Projectile logic
└── README.md

Goals

This project is focused on learning:

Pygame basics (display, timing, input handling) Simple physics and movement Collision detection Managing game objects and state Organizing a small Python game into modules

About

First pygame project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors