This is a simple implementation of the classic Space Invaders game using C++ and the SDL2 library. The purpose of this project is to provide a fun way to practice C++ programming and familiarize myself with game development concepts.
- Clone the repository or download the source code files.
- Open the Space Invaders project folder in Visual Studio.
- Make sure you have the SDL2 libraries installed on your system.
- In Visual Studio, go to Project > Properties.
- In the project properties, go to Configuration Properties > VC++ Directories.
- Edit the Include Directories and Library Directories to specify the paths to your SDL2 installation.
- Build the project by pressing Ctrl+Shift+B or selecting Build > Build Solution.
- Run the game by pressing Ctrl+F5 or selecting Debug > Start Without Debugging.
If you prefer to compile the project manually, follow these steps:
-
Clone the repository or download the source code files.
-
Make sure you have the SDL2 libraries installed on your system.
-
Open a terminal or command prompt and navigate to the project directory.
-
Compile the source code using the following command:
g++ main.cpp -o space_invaders -lSDL2 -lSDL2_image
If you are using a different compiler, adjust the command accordingly.
-
Run the game:
./space_invaders
The objective of Space Invaders is to destroy a fleet of aliens while avoiding their projectiles and preventing the aliens from reaching the bottom of the screen. sad
- Move the spaceship using the A and D keys or the Left and Right arrows.
- Shoot by pressing the spacebar.
- Destroy all aliens to win the game.
- If any alien reaches the bottom of the screen or collides with the spaceship, the game is over.
- SDL2 Documentation
- SDL2_image Documentation
- Lazy Foo' Productions SDL2 tutorials
- How To Make A Game In C++ & SDL2 From Scratch! by Let's Make Games
- Laser shooting audio - laser3 by nsstudios
This project is licensed under the MIT License. Feel free to use and modify the code for personal or educational purposes.