A simple Snake game implemented in C using SDL2.
This project showcases a Snake game developed using the SDL2 library in C. The game revolves around a growing snake that feasts on apples while evading collisions with itself. Additionally, when encountering the window boundaries, the snake reappears on the opposite side of the screen.
- Classic Snake gameplay
- SDL2 for graphics and input handling
- Collision detection
- Menu functionality
- C compiler (GCC recommended) with MinGW for Windows
- SDL2 library installed
-
Clone the repository:
git clone https://github.com/HuzPro/SnakeGame.git
-
Download the additional files from this link and place them in the same directory as the cloned repository files.
-
Compile the game:
-
Linux:
make
Windows:
gcc -std=c99 main.c -I SDL2 -L lib -Wall -lmingw32 -lSDL2main -lSDL2 -lSDL2_image -lSDL2_ttf -mwindows -o main.exe
Run the compiled executable to start the game:
.\main.exe
Use arrow keys to control the snake and mouse to navigate the menu.
- Arrow keys: Move the snake
- Escape key: Open/close menu
- Arrow keys: Move the snake
- Escape key: Open/close menu