RaySnakeSDL is a classic Snake game built using C++20 and the SDL2 library. The project showcases a simple yet enjoyable gaming experience while highlighting SDL2's capabilities in game development.
| Main screen | Game |
|---|---|
- Navigate the snake using the arrow keys or WASD.
- Eat the food to make your snake grow.
- Avoid running into walls or colliding with yourself to keep playing.
- Increase the challenge as the snake moves faster with increasing difficulty.
Follow these steps to build and run the project on your machine.
Ensure you have the following libraries installed on your system:
- SDL2
- SDL2_image
- SDL2_ttf
- SDL2_mixer
On Linux, you can install these dependencies using your package manager. For example, on Arch:
sudo pacman -S sdl2 sdl2_mixer sdl2_image sdl2_ttfor on Mac:
brew install sdl2 sdl2_mixer sdl2_image sdl2_ttf-
Clone the repository:
git clone https://github.com/MatthewFTang/RaySnakeSDL.git cd RaySnakeSDL -
Create a build directory:
mkdir build cd build -
Build the project using CMake and
makeand run:cmake .. make ./RaySnakeSDL
- Arrow Keys or WASD: Control the snake’s direction.
- Objective: Grow your snake by eating the food while avoiding collisions.
- Classic snake game mechanics.
- Difficulty scaling as the snake grows.
- Smooth gameplay using SDL2.
- Cross-platform support.
Contributions are welcome! If you have suggestions for improving the game or adding new features:
- Fork the repository.
- Create a new branch for your feature:
git checkout -b feature/NewFeature. - Commit your changes:
git commit -m 'Add new feature'. - Push to the branch:
git push origin feature/NewFeature. - Open a pull request.
- Thanks to the SDL2 library for providing an excellent framework for game development.
- Inspired by classic Snake games.
Enjoy the game!