Space Invaders is a classic CLI game written in C++. It simulates the nostalgic gameplay where the player controls a spaceship to shoot down advancing aliens, preventing them from reaching the bottom of the screen.
- Player Controls: Move the spaceship left (
a
key) and right (d
key), shoot bullets (spacebar
key), and quit the game (q
key). - Enemy AI: Enemies move horizontally across the screen, reversing direction when reaching the screen edges. They descend towards the player as they move.
- Collision Detection: Bullets fired by the player can hit and destroy enemies. The game tracks hits and updates the score accordingly.
- Game Over: The game ends when all enemies are defeated or when an enemy reaches the bottom of the screen.
- Compile the Game:
- Ensure you have
g++
installed. - Navigate to the project directory and run
make
to compile the game.
- Run the Game:
- After compilation, execute the game by running the executable file generated in the
build
directory.
- Game Controls:
- Use
a
andd
keys to move the player left and right. - Press
- Press
q
to quit the game.
- Gameplay:
- Dodge enemy attacks while shooting them down.
- Prevent enemies from reaching the bottom of the screen to stay in the game.
- Winning:
- You win by defeating all enemies before they reach the bottom of the screen.
- The game displays a victory message when all enemies are destroyed.
- Losing:
- The game ends if any enemy reaches the bottom of the screen.
- It displays a game over message and your final score.