A simple Snake game written in C++ using the Raylib library.
This project was originally created in 2024 as a university course assignment.
The goal was to implement a playable Snake game and understand the code well enough to modify the game's behavior during the final evaluation.
During the assessment, the instructor asked me to change different gameplay parameters, such as the snake size, game speed and grid scale. This helped me demonstrate that I understood how the game logic worked, not only how to run the program.
In 2026, the project was prepared for publication on GitHub by adding a README file, a .gitignore file and a clearer project description.
The project is kept as part of my programming learning history and as an example of working with C++, a game loop, keyboard input, collision detection and simple asset handling.
- Classic Snake gameplay
- Grid-based movement
- Random food spawning
- Score counter
- Collision detection with walls
- Collision detection with the snake's tail
- Texture rendering using Raylib
- Basic sound effects
- Simple class-based structure
- C++
- Raylib
- Makefile based on the default Raylib template
snake-raylib-cpp/
├── main.cpp
├── Graphics/
│ └── food.png
├── Sounds/
│ ├── eat.mp3
│ └── wall.mp3
├── Makefile
├── README.md
├── .gitignore
└── .gitattributes
The project requires Raylib and a C++ compiler.
Example compilation command on Windows:
g++ main.cpp -o main.exe -lraylib -lopengl32 -lgdi32 -lwinmmThen run:
.\main.exeMake sure the Graphics and Sounds folders are placed next to the executable, because the game loads local assets.
The repository contains the source code and assets.
A prebuilt Windows version can be added later in the GitHub Releases section.
A downloadable package should include:
main.exe
Graphics/
Sounds/
Depending on the compiler setup, required DLL files may also need to be included in the same folder as main.exe.
- Basics of C++ game development
- Working with the Raylib library
- Structuring a simple game loop
- Handling keyboard input
- Using classes to organize game logic
- Detecting collisions
- Working with textures and sound effects
- Modifying gameplay parameters such as speed, snake size and grid scale
Archived university assignment.
Originally created in 2024 and prepared for GitHub publication in 2026.
The game is functional and kept as part of my programming portfolio.