Skip to content
CeratonPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Asteroids Game

A classic arcade-style Asteroids game built with Python and Pygame.

Description

Navigate your spaceship, avoid asteroids, and shoot them down in this timeless space shooter. The game features smooth controls, collision detection, and increasing difficulty as more asteroids spawn.

Features

  • Player-controlled spaceship with rotation and thrust
  • Asteroid spawning and movement
  • Shooting mechanics with cooldown
  • Collision detection for player-asteroid and shot-asteroid interactions
  • Game over on player collision
  • Logging of game events and state (for debugging)

Requirements

  • Python 3.8+
  • Pygame

Installation

  1. Clone the repository:
    git clone <repository-url>
    cd Asteroids
    
    
  2. Install dependencies
    pip install pygame
    
  3. (Optional) Set up a virtual environment:
    python -m venv .venv
    source .venv/bin/activate  # On Windows: .venv\Scripts\activate
    pip install pygame
    

Run the game with:

python [main.py]

Controls

A/D: Rotate left/right W/S: Move forward/backward Space: Shoot Close window to quit

Game Mechanics

The player starts in the center of the screen. Asteroids spawn randomly and move in straight lines. Shots destroy asteroids on contact. If the player collides with an asteroid, the game ends. Shots disappear when they leave the screen.

Project Structure

main.py: Main game loop and initialization player.py: Player spaceship class asteroid.py: Asteroid class shot.py: Shot/projectile class circleshape.py: Base class for circular game objects asteroidfield.py: Manages asteroid spawning constants.py: Game constants (sizes, speeds, etc.) logger.py: Logging utilities for game state and events

Customization

Adjust constants in constants.py to change speeds, sizes, or spawn rates. Modify asteroidfield.py for different spawning patterns.

License

This project is for educational purposes. Feel free to modify and distribute.

Troubleshooting

If the game doesn't start, ensure Pygame is installed and your Python version is compatible. Check the console for any error messages. Game logs are saved to game_state.jsonl and game_events.jsonl for debugging.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages