An open API service indexing awesome lists of open source software.

https://github.com/mgobeaalcoba/pygame_space_invasion

Space Invasion game 100% created with Pygame and Python. Applying object-oriented programming, design patterns and advanced programming concepts.
https://github.com/mgobeaalcoba/pygame_space_invasion

design-patterns oop-principles pip pygame pyinstaller python3 venv

Last synced: about 2 months ago
JSON representation

Space Invasion game 100% created with Pygame and Python. Applying object-oriented programming, design patterns and advanced programming concepts.

Awesome Lists containing this project

README

        

# Space Invasion Game

## Overview

Space Invasion is an exciting 2D space shooter game created using Python 3 and Pygame. This game showcases various programming concepts such as Object-Oriented Programming (OOP) and design patterns. Get ready to defend Earth against an alien invasion in this action-packed adventure!

## Features

### Object-Oriented Programming (OOP)

The game is built on the principles of OOP, making the code modular, organized, and easy to maintain. Key OOP concepts include:

- **Classes and Objects**: The game entities like spaceships, bullets, and aliens are represented as classes, making it easy to manage their attributes and behaviors.

- **Inheritance**: We utilize inheritance to create different types of spaceships with shared characteristics, reducing code duplication and promoting a more efficient development process.

- **Encapsulation**: We encapsulate the game logic within classes, preventing unwanted access and ensuring data integrity.

### Design Patterns

Space Invasion incorporates several design patterns to enhance code structure and maintainability:

- **Singleton Pattern**: The game manager class follows the Singleton pattern, ensuring there's only one instance responsible for managing the game's state.

- **Factory Pattern**: A factory pattern is used for creating different types of game entities, making it easier to add new objects in the future.

- **Observer Pattern**: We implement the observer pattern to handle events such as collisions, allowing different game elements to respond appropriately.

### Game Mechanics

- **Player Control**: Players can control a spaceship using the keyboard's arrow keys or custom key bindings. The spaceship can move horizontally, shoot bullets, and destroy incoming alien ships.

- **Alien Invasion**: Aliens descend from the top of the screen in waves, gradually increasing in speed and difficulty. Their goal is to reach the bottom of the screen, and players must prevent this to survive.

- **Power-ups**: Power-ups occasionally appear on the screen, providing players with temporary advantages like increased firepower, shields, or score boosts.

- **Scoring System**: The game keeps track of the player's score, encouraging competition and allowing players to track their progress.

### Graphics and Sound

- **Pygame**: Pygame, a popular Python library, is used for handling graphics, sound, and user input. The game features colorful and visually appealing 2D graphics.

- **Sound Effects**: Engage your senses with captivating sound effects that enhance the gaming experience.

## How to Play

1. **Installation**:

- Ensure you have Python 3 and Pygame installed on your computer.
- Clone the Space Invasion repository to your local machine.

2. **Run the Game**:

- Open your terminal or command prompt and navigate to the game's directory.
- Run the `space_invasion.py` file to start the game.

3. **Game Controls**:

- Use the arrow keys to move your spaceship.
- Press the spacebar to shoot bullets.
- Customize key bindings in the game settings.

4. **Objective**:

- Destroy as many alien ships as possible to earn a high score.
- Avoid letting aliens reach the bottom of the screen.
- Collect power-ups to gain temporary advantages.

5. **Winning**:
- The game continues until your spaceship is destroyed or aliens reach the bottom.
- Try to achieve the highest score and compete with friends!

## Credits

- This game was created by [Your Name].
- Graphics and sound assets were sourced from [Provide Asset Credits].
- Inspired by classic space shooter games and built with love for Python and game development.

## Acknowledgments

- Special thanks to the Pygame community for providing excellent documentation and support.
- This project demonstrates the exciting world of Python programming and game development.

Enjoy Space Invasion and have a blast defending Earth from the alien invasion! Feel free to contribute to the project or share your feedback with us.

## Images