Skip to content

Latest commit

 

History

63 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

🚀 Space Invaders - Console Edition (C++)

🎮 Overview

Space Invaders is a classic 2D arcade shooter game implemented in C++ using Windows console graphics. The game features a player-controlled spaceship that must shoot down waves of descending aliens before they reach the bottom of the screen.

📁 Project Structure

├── spaceinvaders.cpp  # Main game logic and engine
├── help.h             # Graphics & input helper functions (Windows API-based)

🧱 Features

  • Full console-based graphics using Windows GDI
  • Real-time keyboard input (no delays)
  • Dynamic alien movement and shooting
  • Player shooting with collision detection
  • Score and lives tracking
  • Game states: Menu, Playing, Game Over, Win

🕹️ Controls

| Key | Action |

| ← / → | Move the player left/right |

| SPACE | Shoot bullets |

| ENTER | Start / Restart game |

| ESCAPE | Exit or go to menu |

💡 How It Works

  • The game starts in the menu state.
  • Pressing Enter starts the game, and the player can move and shoot aliens.
  • Each alien destroyed adds to your score.
  • If all aliens are destroyed: You Win!
  • If the player is hit 3 times or aliens reach the bottom: Game Over.

🖥️ Requirements

  • Windows OS
  • C++ compiler (MSVC recommended)
  • Windows API and Console subsystem support

🛠️ How to Compile

If using g++ (with Windows setup):

g++ spaceinvaders.cpp -o spaceinvaders -lgdi32

Or using Visual Studio:

  • Create a new Win32 Console Application project.
  • Add spaceinvaders.cpp and help.h to the project.
  • Build and run.

📌 Notes

  • The game uses Windows-specific API functions such as GetAsyncKeyState, SetConsoleCursorPosition, and GDI for simple drawing.
  • This will not work on Linux/Mac terminals without porting.

📄 License

This is a personal or academic project and is free to use and modify.


👨‍💻 Author

Developed with modern C++ principles to demonstrate data structure design, class organization, and logical gameplay programming.


Collaboration Guidelines

We welcome contributions from the open-source community. If you'd like to collaborate on this project, please adhere to the following guidelines:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Implement your changes and commit them with descriptive messages.
  4. Push your branch to your fork and submit a pull request.

Feel free to reach out if you have any questions or suggestions!

About

Space Invaders is a console-based 2D shooting game in C++. The player controls a spaceship, shoots invading aliens, and avoids enemy fire. The game ends when all aliens are destroyed or the player loses all lives.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages