This repository contains a classic Snake game implemented in C++ using the SFML (Simple and Fast Multimedia Library). The game showcases fundamental game development concepts such as game loops, event handling, and rendering.
- Classic Snake Gameplay: Control the snake to eat food and grow longer.
- Smooth Graphics: Utilizes SFML for rendering graphics.
- Responsive Controls: Real-time keyboard input handling.
- Score System: Track your current score during gameplay.
- High Score Tracking: Persistent high score saved across sessions.
- Pause/Resume: Press P or Space to pause the game.
- Restart: Press R to restart after game over.
- Self-Collision: Game ends if the snake collides with itself.
- Dynamic Difficulty: Game speed increases as your score grows.
- Start Menu: Welcome screen with game instructions.
- Cross-Platform: No Windows-specific dependencies.
| Key | Action |
|---|---|
| ↑ | Move Up |
| ↓ | Move Down |
| ← | Move Left |
| → | Move Right |
| P / Space | Pause/Resume |
| R | Restart (after game over) |
| Enter | Start game (from menu) |
| Esc | Quit game |
- C++ Compiler: Ensure you have a C++ compiler installed (e.g., GCC, Clang, MSVC). https://sourceforge.net/projects/gcc-win64/
- SFML Library: Download and install the SFML library from SFML's official website. https://www.sfml-dev.org/download/sfml/2.6.1/
Visual Studio (Windows):
- Open
snake-game-using-sfml.sln - Build the solution
g++ (Linux/macOS):
g++ -o snake codes/src/*.cpp -I codes/headerfiles -lsfml-graphics -lsfml-window -lsfml-systemg++ (Windows with MinGW):
g++ -o snake.exe codes/src/*.cpp -I codes/headerfiles -lsfml-graphics -lsfml-window -lsfml-system- Objective: Guide the snake to eat food and grow longer.
- Scoring: Earn 10 points for each food eaten.
- Speed: Game speed increases every 50 points.
- Game Over: The game ends if the snake collides with the walls or itself.
See CHANGELOG.md for detailed documentation of all features and changes.
Contributions are welcome! If you have any improvements or bug fixes, feel free to open a pull request
- SFML: Thanks to the SFML team for providing an excellent multimedia library.
- Inspiration: Inspired by the classic Snake game.
For any questions or feedback, feel free to reach out to me at kabileshwaran1896@gmail.com

