Skip to content

The demo game

Chili Catch is a small game in examples/demo/demo.cpp. Move the bowl with left/right and catch the falling chillies; three misses end the round. It is about 370 lines and uses every module, so it is the quickest way to see how the parts fit.

Scenes

stateDiagram-v2
    [*] --> Title
    Title --> Play: PLAY (fade)
    Title --> Scores: HIGH SCORES
    Title --> Help: HOW TO PLAY
    Scores --> Title: A / B
    Help --> Title: A / B
    Play --> Play: pause menu, RESTART
    Play --> Entry: 3 misses, top 5 score
    Play --> Over: 3 misses
    Entry --> Over: name done
    Over --> Play: A
    Over --> Title: B

Where each module is used

Module In the demo
Scenes Title, Help, Scores, Play, Entry and Over are chili::Scenes. guard_ms = 300.
Menu Title menu (speed choice, music and sound toggles) and the pause menu.
Screens TextScreen for help, NameEntry for a new score, ScoreTable on two screens.
Save and high scores Save<SaveData> with settings, the last name and a top-5 HighScores.
Music and sound Three songs, five effects, chili::ui_sound for menu sounds.
Effects A burst and a popup per catch, a shake per miss, dim and panel for pause.
Input Through scenes.pressed() and scenes.held().

Build and run it

From a checkout of this repo, next to 32blit-sdk:

cmake -S . -B build
cmake --build build
./build/examples/demo/chili-demo

For the console, add the toolchain options from Get started; the build makes build/examples/demo/chili-demo.blit.