This is your classic arcade Snake game implemented in C++ using the Raylib library and Object-Oriented Programming (OOP) principles. As you know, the snake gets bigger with each bite of food, But did you know that it can get faster too? 😎
And the speed is reset back when the game ends.
- you can pause the game anytime ⏯
- Score Counter
- Player:
- Up, Down, Left, Right:
Arrow keys
- Toggle Play/Pause:
P
- Exit:
Esc
- Up, Down, Left, Right:
- C++ compiler (e.g., g++)
- Raylib library
-
Clone the Repository:
git clone https://github.com/g-magdy/snake-game.git cd snake-game
-
Install Raylib: Follow the instructions on the Raylib website to install Raylib for your operating system.
-
Compile the Game:
make game
-
Run the Game:
./game
- main.cpp: Contains the main game loop and initialization code.
- Constants.h Contains global configuration and constants
- Game class Contains the game logic
- Snake class Draws and moves the snake
- Food class spwans food randomly
Currently, I am the only contributor to this project. However, if you have suggestions or improvements, feel free to fork the repository and create a pull request.
This project is open source and available under the MIT License.
Enjoy playing the Snake game 🐍!