A classic Asteroids game built using Python and Pygame. This project showcases core game mechanics like movement, collision detection, shooting, and object splitting, all while using the pygame library for game graphics and interaction.
To get started with the Asteroids game on your local machine, follow these steps:
-
Clone the Repository:
git clone https://github.com/G1DO/Asteroids.git
-
Navigate to the project directory:
cd Asteroids -
Set up a virtual environment:
For Python 3.10 or later:
python3 -m venv venv
-
Activate the virtual environment:
For Linux/macOS:
source venv/bin/activateFor Windows:
.\venv\Scripts\activate
-
Install the required dependencies:
pip install -r requirements.txt
-
Running the Game:
Run the game using the following command:
python main.py
In this game, you control a spaceship that can rotate and move in space. Your mission is to avoid and shoot at incoming asteroids. The gameplay includes the following features:
- Movement: Use the W, A, S, D keys to move and rotate your spaceship.
- Shooting: Press Spacebar to shoot bullets in the direction your spaceship is facing.
- Asteroids: Asteroids spawn randomly and move in various directions. They can be destroyed by shooting them.
- Game Over: The game ends when your spaceship collides with an asteroid.
- Player Movement: Use keyboard input to rotate and move your spaceship.
- Shooting: Fire bullets to destroy asteroids.
- Asteroids: Randomly spawn and move in different directions. Larger asteroids split into smaller ones when destroyed.
- Collision Detection: Detects collisions between the player’s spaceship and asteroids, triggering a "Game Over" message.
- Python: The main programming language used.
- Pygame: A Python library used for game development, providing graphics, event handling, and other game mechanics.
- Pygbag: For building the game into a web version (HTML, JS).
Watch the demo of the game here: