This is a simple Snakes and Ladders game built using C++ and SFML (Simple and Fast Multimedia Library). The game allows two players to roll the dice and move their pieces accordingly. Snakes will bring you down, and ladders will help you climb up. The first player to reach the last tile wins!
- Graphical Board Display using SFML.
- Two-player support with separate tokens.
- Snakes and Ladders logic implemented.
- Dice rolling mechanism.
- Winning Screen for the first player to reach tile 100.
- Randomized Colors for board tiles.
Before running the game, ensure that SFML is installed on your system. You can install it using the following commands:
sudo apt-get install libsfml-dev
- Download SFML from SFML Official Website.
- Extract the files and set up environment variables.
- Link SFML libraries in your compiler settings.
brew install sfml
Use the following command to compile and run the game:
g++ -o snake_ladder_game game.cpp -lsfml-graphics -lsfml-window -lsfml-system
./snake_ladder_game
g++ -o snake_ladder_game game.cpp -I<sfml-include-path> -L<sfml-lib-path> -lsfml-graphics -lsfml-window -lsfml-system -static-libgcc -static-libstdc++
Replace <sfml-include-path>
and <sfml-lib-path>
with the actual SFML paths on your system.
- Run the game.
- Click on ROLL DICE to roll the dice for the current player.
- Your token moves forward based on the dice roll.
- If you land on a ladder, you climb up.
- If you land on a snake, you go down.
- The first player to reach tile 100 wins!
- The game will display a Winner Screen for the winning player.
📂 SnakesAndLadders
├── 📝 README.md (Game Documentation)
├── 🎨 1.png (Background Image for Winner Screen)
├── 🔤 Pacifico.ttf (Font used for Winner Screen)
├── 🔤 Lobster.otf (Font used for Board Text)
├── 🏗 game.cpp (C++ Codebase)
Developed by [Abdul Ahad] using C++ and SFML. 🚀
If you liked this project, consider giving it a ⭐ on GitHub!