|
RhythmGame 1.4.3
|
Previous | Tutorial | Next: Gameplay
Goal: Show the selected chart or course and let the player start or cancel.
Install docs/examples/theme-tutorial/06-decide/ and choose it for Decide.
Download 06-decide or open the source folder.
The game supplies a GameplayContext as gameplay. Declare it as a required property on the root object.
gameplay.chartData describes the current chart. gameplay.course contains the course definition when playing a course and is undefined for a single chart. Check if (gameplay.course) before using its name or other course data.
Decide and gameplay receive the same context object. In a course, the current chart and players change as stages advance.
Pass the supplied context to StandardDecideFlow. It starts gameplay after five seconds. Enter or a bound play key also starts, while Escape or START+SELECT cancels.
pointerEnabled: false disables the flow's whole-screen mouse area because the example has explicit buttons. The buttons call start() and cancel(), so they share the flow's protection against duplicate transitions.
Set timeoutMillis to 0 to wait for input. You can change the layout while keeping the flow. Override startAction or cancelAction only when you need to replace the whole transition.
The game keeps selection in memory while you play, which preserves its current folder and focus. Starting play replaces decide with gameplay. The game later shows a result above gameplay, then resumes gameplay after the result closes so the flow can advance or return to selection.
Arena rounds open gameplay directly, without decide. StandardMultiplayerFlow handles that transition when the session prepares a round.
If you add shortcuts or audio players yourself, bind their behavior to the screen's enabled state. They don't inherit it like child Items do.
Try starting once by button and once by waiting for the timeout. Then select another chart and cancel. Check a course too, if one is available in your tables. The title should describe the course before its first stage starts.