A classic arcade-style space shooter built with Python and Pygame. Defend Earth by destroying waves of aliens before they reach the bottom of the screen β each level gets faster, harder, and worth more points.
- Move your ship left and right using the arrow keys
- Shoot bullets with the spacebar
- Destroy all aliens to advance to the next level
- You have 3 lives β lose one every time an alien reaches your ship or the bottom of the screen
- The game ends when all lives are lost
- π Progressively increasing difficulty β alien speed and bullet size scale with each level
- π Persistent high score saved locally to
Highscore.json - π On-screen HUD showing current score, high score, level, and remaining lives
- π΅ Dynamic music playlist that cycles through tracks during gameplay, with a separate menu theme
- π Sound effects for shooting, alien kills, level-ups, and losing a life
| Key | Action |
|---|---|
β / β |
Move ship |
Space |
Fire bullet |
Q |
Quit game |
Requirements: Python 3.x
-
Clone the repository:
git clone https://github.com/your-username/Alien-Invasion-Game.git cd Alien-Invasion-Game -
Create and activate a virtual environment (VS Code recommended):
python -m venv venv source venv/bin/activate # macOS/Linux venv\Scripts\activate # Windows
-
Install dependencies:
pip install -r Requirements.txt
-
Run the game:
python alien_invasion.py
Alien-Invasion-Game/
βββ alien_invasion.py # Main game loop and core logic
βββ settings.py # All game configuration and scaling values
βββ ship.py # Player ship class
βββ alien.py # Alien class
βββ bullet.py # Bullet class
βββ button.py # UI button (Play)
βββ game_stats.py # Score, lives, level tracking + highscore persistence
βββ scoreboard.py # HUD rendering
βββ Images/ # Ship and alien sprites
βββ Sound/ # Background music and sound effects
βββ Highscore.json # Auto-generated high score file