Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 Space Invaders

A classic Space Invaders arcade game built with Python and Pygame.

Description

Defend the Earth from waves of alien invaders! Control your spaceship, dodge enemy fire, and destroy all aliens before they overwhelm you. Features sound effects, explosions, a countdown timer, and pause/restart functionality.

Requirements

  • Python 3.x
  • Pygame

Install dependencies with:

pip install pygame

Project Structure

space-invaders/
├── spaceinvaders.py       # Main game loop and entry point
├── spaceship.py           # Player spaceship class
├── alien.py               # Alien enemy class
├── alienbullets.py        # Alien bullet class
└── assets/
    ├── bg.jpg             # Background image
    ├── explosion.wav      # Explosion sound effect
    ├── explosion2.wav     # Secondary explosion sound effect
    └── laser.wav          # Laser fire sound effect

How to Run

python spaceinvaders.py

Controls

Key Action
← / → Move spaceship
Space Fire laser
P Pause game
U Unpause game
R Restart game
End Quit game

Gameplay

  • A 3-second countdown plays before each round begins.
  • Eliminate all 25 aliens (5 rows × 5 columns) to win.
  • Aliens fire back randomly — up to 5 alien bullets can be active at once, with a 1-second cooldown between shots.
  • You start with 3 lives. Lose them all and it's game over.
  • The game ends with a YOU WIN! or GAME OVER! message on screen.

Game Variables

Variable Default Description
rows 5 Number of alien rows
columns 5 Number of aliens per row
alien_cooldown 1000 ms Delay between alien shots
health 3 Player starting lives
fps 60 Frames per second

About

Space Invaders Pygame

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages