Simple Bejeweled/Match-3 game written in C++ and SDL 2.0.
This was built and tested on an M1 Mac with macOS Monterey, but should work on other platforms as well.
These instructions are for compilation with Visual Studio Code on macOS. This assumes you already have Homebrew installed.
You can look for other compile instructions on Lazy Foo' Productions.
-
First, install SDL and extensions:
brew install sdl2 sdl2_image sdl2_ttf sdl2_mixer
-
Then clone the repo:
git clone https://github.com/kim-minh/Jewel-Match.git
Note: On Intel Macs, replace /opt/hombrew/ with /usr/local/homebrew/.
-
In tasks.jsons, add these to "args":
"${workspaceFolder}/src/*.cpp", "-I/opt/homebrew/include", "-I${workspaceFolder}/include", "-lSDL2", "-lSDL2main", "-lSDL2_image", "-lSDL2_ttf", "-lSDL2_mixer", "-L/opt/homebrew/lib",
-
In c_cpp_properties.json, add these to "includePath":
"/opt/homebrew/include", "/opt/homebrew/lib"
Or press Command + SHIFT + P , select C/C++ Edit configurations (GUI) and add to Include path.
Finally, Run Build Task in the directory of the cloned repo.
- If unable to initialize, quit program and output error to Terminal.
- Move to state 2.
- Board is initialized with random tiles that does not have any existing matches. Board is not drawn yet.
- Check if there are any possible moves. There is a chance that the board will be generated without any.
- If no moves are available, recreate the board.
- Board is ready to be played (key press)
- Start timer (default is 120 seconds)
- Check if player has matched any tiles.
- Show hint after 7 seconds of idling.
- Select first tile, select second tile.
- Swap selected tiles.
- If there is at least one match, destroy those that matches, else swap back.
- Drops a single row of new tiles
- Check the board for matches.
- If there are matching tiles, destroy those and repeat state 6.
- Check if there is time left. If not, move to state 8.
- Check if exist moves to match tiles. If not, randomize the board.
- Go back to state 4.
- Show game over and final score.
- Go back to state 3.
Most of this project's assets was taken from Freegemas (GNU GPL v2)
Background music Easy Lemon by Kevin MacLeod, licensed under Creative Commons: By Attribution 3.0
Sound Effects Game Start and Game Over are from Freesound, licensed under Creative Commons: By Attribution 3.0
Font Digital-7 by Style-7 (Free for personal use)
The rest of the project is licensed under GPLv3 (see LICENSE)