A simple 2D Balloon Shooter game built Pygame, following OOP principles. The player controls a gun to shoot moving balloons across different levels.
- Control a gun using the keyboard
- Shoot bullets to pop balloons
- Choose between different levels
- Balloons vary in movement, size, and count depending on the level
| Key | Action |
|---|---|
| W | Move gun up |
| S | Move gun down |
| SPACE | Move gun down |
The project is structured using object-oriented principles:
- Encapsulation: Each game entity (balloon, bullet, gun, level) is its own class
- Inheritance: Levels inherit from a common base Level class
- Modularity: Each component is separated into its own file for clarity and scalability
balloon-shooter/
│
├── assets/ # Game assets (images and sound effects)
│ ├── balloon.png # Balloon sprite
│ ├── cannon.png # Gun sprite
│ ├── impact.mp3 # Bullet impact sound effect
│ ├── pop.mp3 # Balloon pop sound effect
│ └── silencer.mp3 # Shot sound effect
│
├── src/ # Core game source code
│ ├── balloon.py # Balloon entity and behavior
│ ├── bullet.py # Bullet/projectile logic
│ ├── game.py # Main game loop and state management
│ ├── gun.py # Player mechanics
│ ├── level_1.py # Level 1 configuration and logic
│ ├── level_2.py # Level 2 configuration and logic
│ └── level.py # Base level class and shared functionality
│
├── .gitignore # Files and folders ignored by Git
├── config.env # Environment and game configuration variables
├── LICENSE # Project license information
├── main.py # Game entry point
├── README.md # Project documentation
└── requirements.txt # Python dependencies
- main.py: Entry point of the game. Initialises and starts the game.
- game.py: Handles the main game loop and prompts the user to select a level.
- level.py: Base class for all game levels. Defines common behavior and structure.
- level_1.py implements Level 1:
- Single balloon
- Random movement and size
- level_2.py Implements Level 2:
- Multiple balloons
- Randomized movement and sizes for each balloon
- gun.py: Manages gun movement and rendering.
- bullet.py: Handles bullet creation, movement, and collision logic.
- balloon.py: Defines balloon properties such as size, movement, and behavior.
- Clone the repository:
git clone https://github.com/7echkilla/balloon-shooter.git - Navigate to the project directory:
cd balloon-shooter - Load dependencies:
pip install -r requirements.txt - Run the game:
python main.py
