Skip to content

psmarter/Alien-Invasion-Project

Repository files navigation

👾 Alien Invasion | 外星人入侵

English | 中文


🎮 English

A classic arcade-style space shooter game built with Python and Pygame. Defend Earth from waves of alien invaders!

✨ Features

  • Classic Gameplay: Traditional arcade-style shooting mechanics
  • Progressive Difficulty: Game speed and alien points increase with each level
  • Score Tracking: Real-time score display and high score tracking
  • Multiple Lives: Start with multiple ships and try to survive
  • Smooth Controls: Responsive keyboard controls for ship movement and shooting
  • Level System: Advance through increasingly challenging levels

🚀 Quick Start

Prerequisites

  • Python 3.7 or higher
  • Pygame library

Installation

  1. Clone the repository:
git clone https://github.com/psmarter/Alien-Invasion-Project.git
cd Alien-Invasion-Project
  1. Install dependencies:
pip install -r requirements.txt
  1. Run the game:
python alien_invasion.py

🎯 How to Play

  • Move Left: ← Left Arrow Key
  • Move Right: → Right Arrow Key
  • Shoot: Space Bar
  • Start Game: Click "Play" button
  • Quit: Q key or close window

📁 Project Structure

Alien-Invasion-Project/
├── alien_invasion.py    # Main game loop and logic
├── ship.py             # Player ship class
├── alien.py            # Alien enemy class
├── bullet.py           # Bullet projectile class
├── button.py           # UI button class
├── settings.py         # Game settings and configuration
├── game_status.py      # Game state management
├── gamescore.py        # Score and level tracking
├── imgs/               # Game image assets
│   ├── ship.bmp       # Player ship sprite
│   └── alien.bmp      # Alien enemy sprite
└── requirements.txt    # Python dependencies

🛠️ Technical Details

Built With:

  • Python 3.x
  • Pygame 2.x

Design Pattern:

  • Object-oriented programming with separate classes for game entities
  • Sprite groups for efficient collision detection
  • Event-driven input handling

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

See CONTRIBUTING.md for detailed guidelines.

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

🌟 Acknowledgments

  • Inspired by the classic Space Invaders arcade game
  • Built as a learning project following Python game development best practices

🎮 中文

一个使用Python和Pygame构建的经典街机风格太空射击游戏。保护地球免受外星入侵者的攻击!

✨ 游戏特性

  • 经典玩法: 传统街机风格的射击机制
  • 渐进难度: 游戏速度和外星人分数随关卡递增
  • 分数追踪: 实时分数显示和最高分记录
  • 多条生命: 开局拥有多艘飞船,尽力生存
  • 流畅操控: 响应式键盘控制飞船移动和射击
  • 关卡系统: 通过越来越具挑战性的关卡

🚀 快速开始

环境要求

  • Python 3.7 或更高版本
  • Pygame 库

安装步骤

  1. 克隆仓库:
git clone https://github.com/psmarter/Alien-Invasion-Project.git
cd Alien-Invasion-Project
  1. 安装依赖:
pip install -r requirements.txt
  1. 运行游戏:
python alien_invasion.py

🎯 游戏操作

  • 向左移动: ← 左方向键
  • 向右移动: → 右方向键
  • 射击: 空格键
  • 开始游戏: 点击"Play"按钮
  • 退出: Q键 或 关闭窗口

📁 项目结构

Alien-Invasion-Project/
├── alien_invasion.py    # 主游戏循环和逻辑
├── ship.py             # 玩家飞船类
├── alien.py            # 外星敌人类
├── bullet.py           # 子弹发射物类
├── button.py           # UI按钮类
├── settings.py         # 游戏设置和配置
├── game_status.py      # 游戏状态管理
├── gamescore.py        # 分数和关卡追踪
├── imgs/               # 游戏图像资源
│   ├── ship.bmp       # 玩家飞船精灵
│   └── alien.bmp      # 外星敌人精灵
└── requirements.txt    # Python依赖项

🛠️ 技术细节

构建技术:

  • Python 3.x
  • Pygame 2.x

设计模式:

  • 面向对象编程,游戏实体使用独立类
  • 精灵组用于高效碰撞检测
  • 事件驱动的输入处理

🤝 参与贡献

欢迎贡献!请随时提交Pull Request。对于重大更改,请先开issue讨论您想要更改的内容。

详细指南请参阅 CONTRIBUTING.md

📝 许可证

本项目采用MIT许可证 - 详见 LICENSE 文件。

🌟 致谢

  • 灵感来自经典的太空侵略者街机游戏
  • 作为Python游戏开发最佳实践的学习项目构建

⭐ If you like this project, please give it a star!
⭐ 如果你喜欢这个项目,请给它一个星标!

About

一个使用Python和Pygame构建的经典街机风格太空射击游戏

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages