Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

👾 ALIENS

A 2D arcade space shooter built with Python and Pygame: battle waves of aliens, defeat the boss, and climb the high score leaderboard.


📖 Description

Aliens is a 2D arcade game inspired by classic space shooters. The player controls a spaceship that must destroy waves of aliens coming from above. The game is divided into 3 rounds plus a final boss. Once the boss is defeated, the cycle restarts with an increased difficulty level.

The project is designed to be simple, lightweight, and easily extensible: it's a great starting point for anyone learning game development with Pygame.


✨ Features

  • 🎮 Flexible controls: play with the keyboard, with the mouse (shooting only), or in hybrid mode.
  • 👾 Three alien types:
    • Green – moves with side bouncing.
    • Gray – moves in a zig-zag pattern.
    • Red – shoots projectiles at the spaceship.
  • 💀 Final boss with a health bar, laser attacks, and fire bursts.
  • 🛡️ Power-ups:
    • Shield (S) – absorbs one hit and makes the spaceship invulnerable for 200 ms (flashing effect).
    • Rapid fire (R) – reduces shooting cooldown (lasts 10 s).
    • Multi-shot (M) – fires 3 bullets in a spread pattern (lasts 10 s).
  • 📈 Progressive difficulty: after each boss, alien speed and spawn rate increase.
  • 🏆 High score: saves the top 5 scores with the player's name.
  • 🔊 Sound effects: synthetic sounds generated dynamically (with numpy) or custom .wav files (optional, not included).
  • 🎨 Minimalist graphics: colored geometric shapes, no external assets.

🕹️ How to Play

Objective

Destroy as many aliens as possible, survive the three rounds, and defeat the final boss. Each completed cycle increases the difficulty.

Controls

Action Keyboard Mouse
Move left ← or A —
Move right → or D —
Shoot SPACE Left click
Start game SPACE (from menu) —
Restart (after Game Over) R —
Confirm name (high score) ENTER —

Note: movement is keyboard-only; the mouse is used exclusively for shooting. The game supports all combinations: keyboard only, keyboard + mouse, or mouse + keyboard.


📊 Game Mechanics

Rounds and Levels

Round Enemies Score Required
Round 1 Green aliens 100 points
Round 2 Green + Gray aliens 200 points
Round 3 Green + Gray + Red aliens 300 points
Boss Final boss (20 hits) —

After defeating the boss:

  • The level increases (from 1 to 2, 3, 4…).
  • Difficulty increases by 0.1 per level.
  • The round score resets, but the total score keeps growing.
  • Active power-ups are removed.

Scoring

Event Points
Alien kill +10
Alien off-screen (penalty) −5
Boss hit +0 (no points)

Power-ups

Power-up Effect Duration How to Obtain
🛡️ Shield Absorbs one hit, then 200 ms invulnerability Until 1 hit Red aliens (30%), boss (every 10 hits)
⚡ Rapid fire Cooldown reduced from 250 ms to 150 ms 10 seconds Boss (every 15 hits)
✳️ Multi-shot 3 bullets in a spread pattern 10 seconds Boss (every 15 hits)

🚀 Installation

Requirements

  • Python 3.8+
  • Pygame 2.0+
  • (Optional) NumPy – for synthetic sounds

Steps

  1. Clone the repository:

    git clone https://github.com/your-username/aliens.git
    cd aliens
  2. Install dependencies:

    pip install pygame
    pip install numpy    # optional, for synthetic sounds
  3. Run the game:

    python Aliens.py

Custom Sounds (Optional)

By default, the game uses synthetic sounds generated with NumPy. If you want to use custom sounds, place these .wav files in the same folder as Aliens.py:

  • sparo.wav – shooting sound
  • esplosione.wav – alien explosion sound
  • powerup.wav – power-up pickup sound
  • gameover.wav – game over sound
  • boss_morte.wav – boss death sound

If these files are missing, the synthetic sounds (or silence) will be used.


📁 Project Structure

aliens/
├── Aliens.py            # Main game script
├── LICENSE              # MIT License
└── README.md            # This file

Note: The highscore.json file is created automatically at runtime to save your scores.


🛠️ Technologies Used

  • Python 3 – Programming language
  • Pygame – Library for 2D game development
  • NumPy (optional) – Synthetic sound generation
  • JSON – High score saving

🤝 Contributing

Contributions are welcome! If you want to improve the game, follow these steps:

  1. Fork the project.
  2. Create a branch for your feature:
    git checkout -b feature/new-feature
  3. Commit your changes:
    git commit -m "Add new feature"
  4. Push the branch:
    git push origin feature/new-feature
  5. Open a Pull Request.

🐛 Known Bugs and Possible Improvements

  • Add more alien types (e.g., armored aliens).
  • Implement a lives system.
  • Add a pause screen.
  • Joystick/gamepad support.
  • Animated backgrounds and custom sprites.

📜 License

This project is released under the MIT License. See the LICENSE file for more information.


👤 Author

damarant

If you like the project, leave a ⭐ on the repository!


🙏 Acknowledgements

  • To the Pygame community for the excellent library.
  • To all players who will enjoy Aliens.

About

A 2D arcade space shooter built with Python and Pygame

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages