GitHub - code-qtzl/asteroids: Classic Astroids

Repository files navigation

Asteroids

asteroids banner

Python

A fun little pygame program to help improve my python skills. Why not Asteroids?!

Features

Pygame Objects

  • Clock (pygame.time.Clock): Controls frame rate and game timing
  • Sprite Groups (pygame.sprite.Group): Manages game objects
    • Updatable sprites
    • Drawable sprites
    • Asteroid sprites
    • Shot sprites
  • List: List for array operations

Game Architecture

  • Class Inheritance: Base CircleShape class extended by:
    • Player
    • Shot
    • Asteroid
    • Alien
  • Event System: Handles player input and game events
  • Collision Detection: Manages object interactions
  • Score System:
    • AWS DynamoDB
    • Local display of current and high scores during gameplay
    • Scores stored by unique hostname/username

Game Controls

Key Action
↑ (Up Arrow) Thrust Forward
↓ (Down Arrow) Thrust Backward
← (Left Arrow) Rotate Left
→ (Right Arrow) Rotate Right
Space Fire
P Pause Game

Prerequisite

  1. pygame:

    • python3 -m pip install -U pygame==2.6.0
  2. AWS SDK (boto3):

    • Included in requirements.txt
    • AWS credentials required for high score feature
  3. venv virtual environments:

    • python -m venv C:\path\to\new\virtual\environment

Running the Project

git clone https://github.com/code-qtzl/asteroids.git
cd asteroids
source venv/bin/activate
python main.py

✨ Gameplay

Game Play

Gameplay

Game Play

Highscore

The History of Asteroids

Not my video, but found it to be a fun watch on the history of Asteroids.

The History of Asteroids

Contact

Feel free to reach out to collab or if you have and questions!