Skip to content

A classic arcade space shooter game built with Python and Pygame. Final project from the Python Crash Course book, demonstrating OOP, event-driven architecture, and game state management.

Notifications You must be signed in to change notification settings

Shivam56291/python-pygame-alien-invasion

Repository files navigation

👾 Arcade-style Space Shooter • Built with Python & Pygame


🎥 Gameplay Preview

Preview of Alien Invasion gameplay


✨ Core Features

This game implements classic arcade mechanics with increasing difficulty and persistent scoring, serving as a robust demonstration of object-oriented game design.

  • Responsive Controls: Smooth player movement and accurate bullet firing using keyboard input.
  • Dynamic Difficulty: The alien fleet accelerates and appears in faster waves as the player progresses, creating a challenging loop.
  • Scoring & High Scores: Real-time score tracking and persistent storage of the highest achieved score across sessions.
  • Game State Management: Implements clear states for Title Screen, Game Active, and Game Over, controlled by an event-driven loop.
  • Sound Effects: Basic sound integration for laser firing and alien destruction (Crucial for game feel!).

🚀 Getting Started (How to Run)

To run this game locally, ensure you have Python installed and follow these steps.

⚙️ Prerequisites

You need Python 3.10 or higher and the Pygame library.

# Verify Python installation
python --version

🚀 Getting Started (How to Run)

To run this game locally, ensure you have Python installed and follow these steps.

📦 Installation

  1. Clone the repository:

    git clone [https://github.com/your-username/alien-invasion.git](https://github.com/your-username/alien-invasion.git)
    cd alien-invasion
  2. Install the dependencies:

    pip install -r requirements.txt
    # If no requirements.txt is provided, you can install Pygame directly:
    # pip install pygame

▶️ Execution

Run the main game file directly from your terminal:

python alien_invasion.py

🕹️ Controls

Action Key(s)
Move Ship Left (Left Arrow) or A
Move Ship Right (Right Arrow) or D
Fire Bullet Spacebar
Start/Restart Game P (Play)
Quit Game Q or Esc

📚 Review & Reflection (BCA Student Perspective)

As a BCA student focusing on full-stack development and complex systems, completing Alien Invasion was a valuable exercise in core software principles, specifically Object-Oriented Programming (OOP) and Event-Driven Architecture.

On "Python Crash Course":

The book provides an incredibly structured and clear pathway from raw Python basics to applying those skills in a tangible project. The Alien Invasion project served as an excellent introduction to:

  • Object-Oriented Design: Effectively utilizing classes for the Ship, Bullet, and Alien to manage game state and behavior. This demonstrated how OOP makes code reusable and scalable.
  • Code Organization: Learning how to manage modules for settings, sprites, and main game logic (separating concerns), a skill vital for larger development environments.
  • Iterative Development: Building the game piece by piece—movement first, then bullets, then collisions—mirrored real-world agile methodology.

💡 Personal Takeaway:

This project was instrumental in solidifying my understanding of the game loop—the continuous cycle of handling input, updating game state, and rendering graphics.

While my career focus is on scalable web backends (Spring Boot/NestJS), this project reinforced the importance of tight code structure and efficient state management, skills that are directly transferable to any complex application.

"A huge thanks to Eric Matthes for this foundational project. It’s a perfect bridge from theoretical learning to practical, rewarding development."


Built for learning. Polished for showcasing. 🚀

About

A classic arcade space shooter game built with Python and Pygame. Final project from the Python Crash Course book, demonstrating OOP, event-driven architecture, and game state management.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages