A two-player luck-based game built with C++ and Raylib where players must avoid poisoned candies to survive.
Poison Candy is a turn-based game for two players. The game features a grid of 30 candies where each player secretly selects one candy to poison. Players then take turns eating candies, trying to avoid the poisoned ones. The player who eats a poisoned candy loses the game. This original game was inspired by a TikTok trend which followed the same rules and players ate actual candy.
- 30 candies are arranged in a 5×6 grid with random colors
- Player 1 selects a candy to poison (Player 2 looks away)
- Player 2 selects a different candy to poison (Player 1 looks away)
- Players alternate turns eating candies
- Eaten candies are removed from the board
- If a player eats a poisoned candy, they lose immediately
- The other player wins the game
- Mouse-controlled interface with visual feedback
- Multi-screen game flow (instructions, poison selection, gameplay, game over)
- Random candy colors for visual variety
- A candy is highlighted when mouse hovers over it
- Clean object-oriented C++ implementation
- Cross-platform compatibility through Raylib
- Install a C++ compiler (e.g., GCC or MinGW for Windows).
- Install Raylib (a simple and easy-to-use library for game development).
- Ensure you have a terminal or command prompt to run commands.
- Clone or download the project
- Navigate to project directory
- Run the following command to compile the game:
make all- Or use this command to compile and run the game in one step:
make runTo remove compiled files and clean the project, run:
make clean- C++ compiler with C++17 support
- Raylib graphics library
- Minimum display resolution: 1200×700 pixels
- Mouse input device
- Left Click: Select candies and navigate menus
- Mouse Hover: Highlight candies for selection
PoisonCandy/
├── headers/ # Header files
│ ├── Candy.hpp # Candy class definition
│ ├── Screens.hpp # Game screen states
│ └── Utils.hpp # Utility functions
├── source/ # Implementation files
│ ├── Candy.cpp # Candy class methods
│ └── Utils.cpp # Utility implementations
├── main/ # Main application
│ └── Main.cpp # Game logic and entry point
├── bin/ # Compiled executables (generated)
├── obj/ # Object files (generated)
├── Makefile # Build configuration
└── .gitignore # Version control ignore file
The game is implemented using:
- Language: C++17
- Graphics Library: Raylib
- Architecture: Object-oriented design with separate classes for game components
- Build System: Makefile for cross-platform compilation
- State Management: Enum-based screen management
- Different grid sizes (4×4, 6×6, etc.)
- Improved graphics and animations
- Better visual indicators for game state
- Colorblind accessibility options
- Keyboard controls as alternative to mouse
The project uses a Makefile that:
- Compiles all
.cppfiles fromsource/andmain/directories - Links against Raylib and required system libraries
- Generates executable in the
bin/directory - Supports Windows-specific flags (
-mwindowsfor GUI application)