Build a GameCreating Crystal Cascade

7  Title and Main Menu

Goal

Open your game on its own Title screen. Choose a game, read its controls, and return to the menu when the well fills.

The game as it is at the end of this chapter. Click the game, then press Enter to start.

This chapter’s finished project can help you compare a piece that behaves differently.

Crystal Cascade, Chapter 7 finishedZip of a Myth project · 4.6 MB

To open it, right-click the downloaded file, choose Extract All... and then Extract. Start Myth Engine, choose File › Open Project... and pick the .mythproj file in the new folder. Nunito-OFL.txt beside it comes with the game.

7.1 The Idea

Soap bubbles rise behind the logo. Loose crystals tumble past them, and PRESS ENTER TO PLAY dims and brightens under the glass letters. The well can wait.

Press Enter. The logo gives way to a menu, and the chosen button glows. Beside it, a panel tells you what that choice offers. Your game has somewhere to begin before a single piece falls into the well.

The results panel already knows how to offer a choice. We’ll give that same idea more room: several buttons, one chosen number, and a listener for each button’s job. The menu is another panel.

There’s a quiet problem behind HOW TO PLAY. The buttons remain underneath, with their sensors and listeners still waiting for a player to choose them. A veil can cover their pictures without stopping their Logic. Help borrows their controls.

Confirm normally runs the selected button. While help is open, that same Event closes help instead. Modes keep those responses separate until the menu is ready again.

7.2 The Plan

  • Title Controls hears Confirm or a left click -> Go To The Main Menu changes Scene.
  • Panel Choices changes the remembered choice. Main Menu Controls announces that choice so the text can follow. Their connection runs through Panel Choices and Main Menu Controls before Show Menu Info hears menuChoiceChanged.
  • Show Menu Info reads that choice’s row. A chosen button sends choiceRun to its own job.
  • Open How To Play sends howToPlayOpened -> pictures appear and menu Events switch Modes.
  • Closing help restores those Modes. BACK TO MENU brings the results back to the same remembered choice.

7.3 Set Up

Start with your completed Chapter 6 project or download Chapter 6 finished. Open its project before adding this chapter’s pieces.

Check that it contains Piece Kinds, Choose Panel Choice, Panel Choice and Show When Panel Choice. Its Results Panel and Menus controls are used again here. These inherited resources come from Chapter 6; this chapter changes them rather than rebuilding their earlier work. The Starter Kit already includes this chapter’s logo, key pictures and music.

Add Menu Navigate and Back in the Menus input context. Menu Navigate’s Input Type is 2D Axis, because the menu needs both vertical selection and horizontal level changes. Back uses Input Type Button. Give each direction every key shown on the card. The helper page explains selecting a context before adding its Commands.

Make the new Scenes Main Menu and Title before building Functions that choose them. Use the setup card’s camera, view and sky for each. Leave Start Scene alone until Title exists, then select Title there.

The placement list is long. We’ll return to its Scene headings as each group is ready. Screen UI positions are offsets in pixels; bubbles and drifting crystals use world positions in meters.

Add the listed Globals through a Logic’s Globals block. A Global already present needs no second declaration. The menu remembers menuChoice, while mode and the level choices wait for the game to read them.

Set upWhat this chapter adds
ART (sprites, from the starter kit)
Crystal Cascade Logo
Info Glass Panel
Key Left
Key Right
Key Up
Key Down
Key Enter
Key Esc
Key Space
Key C
Key Shift
Key X
Key Z
Key Ctrl
Key A
Key P
Soap Bubble
SOUNDS (from the starter kit)
Menu Back
Aurora Glass (Menu Theme)
Crystal Current (Game Theme)
COMMANDS (Game Settings > Input Manager)
Menu Navigate2D Axis
LeftLeft Arrow, A
RightRight Arrow, D
UpUp Arrow, W
DownDown Arrow, S
BackButton
KeybindingsEscape, Backspace
INPUT CONTEXTS (Game Settings > Input Manager)
MenusInactive at Start(changed)
CommandsConfirm, Menu Navigate, Back
GLOBAL VARIABLES
$menuChoiceNumberstarts at 0
$modeNumberstarts at 1
$startLevelNumberstarts at 1
$firstLevelNumberstarts at 1
SCENE Gameplay: PLACE THESE
ObjectXY
Rising Bubble1.40616.438
Rising Bubble21.7819.375
Rising Bubble8.40627.563
Rising Bubble52.5313.344
Rising Bubble53.257.906
Rising Bubble17.7814.313
Rising Bubble46.511.25
Rising Bubble2.31330.688
Rising Bubble44.40628
Rising Bubble17.68823.938
Rising Bubble54.71931.219
Rising Bubble12.31310.563
Rising Bubble5.81332.438
Rising Bubble44.15618.875
BACK TO MENU Button0261
BACK TO MENU Highlight0261
with Per Instance Variables > Choice = 1
BACK TO MENU Label0259.5
with Z-Index = 148
SCENEMain Menu (new)
Camera Main CameraX 30, Y 16.875, view 60 x 33.75 m
View Main View1920 x 1080 pixels, camera Main Camera
BackgroundAero Sky
Background Color#1A78C8
SCENE Main Menu: PLACE THESE
ObjectXY
Main Menu Logo0-168
Main Menu Flow033.75
MARATHON Highlight-390147
MARATHON Button-390147
MARATHON Label-390145.5
with Z-Index = 102
SPRINT 40 Highlight-39054
SPRINT 40 Button-39054
SPRINT 40 Label-39052.5
with Z-Index = 102
ULTRA Highlight-390-39
ULTRA Button-390-39
ULTRA Label-390-40.5
with Z-Index = 102
ZEN Highlight-390-132
ZEN Button-390-132
ZEN Label-390-133.5
with Z-Index = 102
HOW TO PLAY Highlight-390297
HOW TO PLAY Button-390297
HOW TO PLAY Label-390295.5
with Z-Index = 102
QUIT Highlight-390204
QUIT Button-390204
QUIT Label-390202.5
with Z-Index = 102
Info Panel41.71914.063
Info Title375135
with Z-Index = 120
Info Line 137545
with Z-Index = 120
Info Line 2375-3
with Z-Index = 120
Info Line 3375-51
with Z-Index = 120
Start Level Label270-91.5
with Z-Index = 121
Start Level Left Key462.84-90
Start Level Value530.34-91.5
with Z-Index = 121
Start Level Right Key597.84-90
Menu Hint Up Key-307.5245
Menu Hint Down Key-255.3245
Menu Hint CHOOSE-164.0343.5
with Z-Index = 131
Menu Hint Enter Key-2.345
Menu Hint PLAY84.4343.5
with Z-Index = 131
Menu Hint Esc Key211.3645
Menu Hint BACK289.8643.5
with Z-Index = 131
Help Veil00
Help Panel00
Help Title0-312
with Z-Index = 155
Help Keys 0-0 0-510132
Help Keys 0-0 1-450132
Help Action 0-0-193.5130.5
with Z-Index = 155
Help Keys 0-1 0-48063
Help Action 0-1-193.561.5
with Z-Index = 155
Help Keys 0-2 0-480-6
Help Action 0-2-193.5-7.5
with Z-Index = 155
Help Keys 0-3 0-530.4-75
Help Keys 0-3 1-450-75
Help Action 0-3-193.5-76.5
with Z-Index = 155
Help Keys 1-0 0157.5132
Help Keys 1-0 1217.5132
Help Action 1-0474130.5
with Z-Index = 155
Help Keys 1-1 0143.4763
Help Keys 1-1 1217.563
Help Action 1-147461.5
with Z-Index = 155
Help Keys 1-2 0187.5-6
Help Action 1-2474-7.5
with Z-Index = 155
Help Keys 1-3 0157.5-75
Help Keys 1-3 1227.7-75
Help Action 1-3474-76.5
with Z-Index = 155
Help Back 0-90.94318
Help Back 1-34.69316.5
with Z-Index = 156
Help Back 210.31318
Help Back 392.25316.5
with Z-Index = 156
Rising Bubble1.40612.125
Rising Bubble7.81327.125
Rising Bubble38.87520.375
Rising Bubble55.21913.875
Rising Bubble34.90610.031
Rising Bubble39.71920.063
Rising Bubble36.81310.125
Rising Bubble5.37513.313
Rising Bubble25.59427.75
Rising Bubble39.62521.75
Rising Bubble21.4068.688
Rising Bubble4612.844
Rising Bubble54.21915.125
Rising Bubble49.40630.25
Drifting Crystal1.56315.125
Drifting Crystal7.4386.125
Drifting Crystal21.18817.219
Drifting Crystal34.0949.719
Drifting Crystal49.84420.219
Drifting Crystal55.1252.406
SCENETitle (new)
Camera Main CameraX 30, Y 16.875, view 60 x 33.75 m
View Main View1920 x 1080 pixels, camera Main Camera
BackgroundAero Sky
Background Color#1A78C8
GAME SETTINGS > General > Startup
Start SceneTitle · 2D
SCENE Title: PLACE THESE
ObjectXY
Title Logo0165
Press Start Pill0-165
Press Start PRESS-189.97-166.5
with Z-Index = 107
Press Start Enter Key-28.21-165
Press Start TO PLAY161.76-166.5
with Z-Index = 107
Title Flow033.75
Rising Bubble1.40629.375
Rising Bubble6.53121.719
Rising Bubble31.37516.281
Rising Bubble44.4384.531
Rising Bubble51.0941.469
Rising Bubble9.18822.625
Rising Bubble18.31314.656
Rising Bubble50.31317.219
Rising Bubble43.62528.781
Rising Bubble9.09430.531
Rising Bubble40.2810.375
Rising Bubble25.6253.719
Rising Bubble32.21918.688
Rising Bubble28.37517.625
Drifting Crystal1.4387.906
Drifting Crystal18.21916.75
Drifting Crystal40.21924.969
Drifting Crystal33.6254.938
Drifting Crystal52.40611
Drifting Crystal12.81320.219
Drifting Crystal35.93821.219
Drifting Crystal12.03120.313
Drifting Crystal7.2198.313

7.4 The Sky Keeps Moving

The first new pieces need no keys.

Make Rise And Sway Data now, so its rising field exists before the Logic needs to remember that speed. Each bubble keeps its own rising speed in that structure. The sideways direction will change, but that upward speed stays with the bubble.

Data StructureRise And Sway Data

Object Data of Logic "Rise And Sway" (its state that lasts between Events). rising: how fast this bubble rises, in meters per second.

risingNumberdefault 0

7.4.1 Rise And Sway

A large bubble passes a smaller one. The same random size chooses how large, how bright and how fast each bubble becomes. Those differences belong together.

Rise And Sway sets velocity once. Its sway timer changes the sideways sign while keeping the stored rising speed. Make both timer Modes first.

Leaving the view sends the same bubble below the screen. It finds another starting X within the same view and begins another trip past the logo. No stream of new bubbles needs cleaning up.

Logic ComponentRise And SwayAttach to: Rising Bubble

A soap bubble: a random size (bigger ones rise faster and show more), rising and swaying side to side; back to the bottom when it leaves the top.

Attach toAny Object
DATA STRUCTURES
Rise And Sway Dataself.riseAndSwayData
SHARED VARIABLES
NameTypeKindStarting Value
smallestSizeNumberConstant0.22
largestSizeNumberConstant0.85
riseSpeedNumberConstant0.656
risePerSizeNumberConstant2.156
swaySpeedNumberConstant0.75
swaySecondsNumberConstant4.5
leftmostNumberConstant1.406
rightmostNumberConstant58.594
bottomStartNumberConstant-3.75
When Created
WhenCreate
1Generate Random Number
Action Name
bubbleSize
Minimum
@self.smallestSize
Maximum
@self.largestSize
2Set Scale
Horizontal Scale
bubbleSize.value
Vertical Scale
bubbleSize.value
3Set Alpha
Alpha
0.35 + bubbleSize.value * 0.55
4Change Component Value
Component Value
self.riseAndSwayData.rising
Value
@self.riseSpeed + bubbleSize.value * @self.risePerSize
5Set Velocity
X Velocity
@self.swaySpeed
Y Velocity
self.riseAndSwayData.rising
6Start Recurring Timer
Timer Name
"sway"
Repeat Every (s)
@self.swaySeconds
When Leaving the View
WhenLeave View
1Generate Random Number
Action Name
bubbleX
Minimum
@self.leftmost
Maximum
@self.rightmost
2Set Position
X
bubbleX.value
Y
@self.bottomStart
On the Sway Timer
WhenRecurring TimerTimer name: sway
ModeSwaying Right (Starting Mode)
1Set Velocity
X Velocity
-@self.swaySpeed
Y Velocity
self.riseAndSwayData.rising
2Switch Mode
Event
On the Sway Timer
Mode
Swaying Left
On the Sway Timer
WhenRecurring TimerTimer name: sway
ModeSwaying Left
1Set Velocity
X Velocity
@self.swaySpeed
Y Velocity
self.riseAndSwayData.rising
2Switch Mode
Event
On the Sway Timer
Mode
Swaying Right

Make Rising Bubble now. The From Logic component arrives with it. Its negative draw order keeps the bubble behind the glass and text.

ObjectRising Bubble
Sprite
Scene Depth Draw Order-60
SpriteSoap Bubble
Transform > SizeX 6, Y 6
Data Structure
From LogicRise And Sway
Data StructureRise And Sway Data
Logic
Rise And Sway

7.4.2 Drift Down

The crystals travel the other way. Each begins with a color from Piece Kinds and its own scale, alpha and spin. A negative Y velocity carries it downward.

Drift Down returns a departing crystal above the view. This time it chooses a fresh color from Piece Kinds before returning to the passing bubbles. The shape gets another passage through the sky, while its other settings stay with it.

Logic ComponentDrift DownAttach to: Drifting Crystal

A crystal of a random color, size, see-through and spin, falling; back to the top, as a new color, when it leaves the bottom.

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
slowestFallNumberConstant1.6
fastestFallNumberConstant2.7
fastestSpinNumberConstant40
smallestScaleNumberConstant0.9
largestScaleNumberConstant1.7
faintestNumberConstant0.55
clearestNumberConstant0.9
leftmostNumberConstant1.875
rightmostNumberConstant58.125
topStartNumberConstant36.563
When Created
WhenCreate
1Generate Random Integer
Action Name
colorRow
Maximum
dataCount('Piece Kinds') - 1
2Set Frame
Frame
data('Piece Kinds', colorRow.value, 'frame')
3Generate Random Number
Action Name
crystalScale
Minimum
@self.smallestScale
Maximum
@self.largestScale
4Set Scale
Horizontal Scale
crystalScale.value
Vertical Scale
crystalScale.value
5Generate Random Number
Action Name
crystalAlpha
Minimum
@self.faintest
Maximum
@self.clearest
6Set Alpha
Alpha
crystalAlpha.value
7Generate Random Number
Action Name
crystalSpin
Minimum
-@self.fastestSpin
Maximum
@self.fastestSpin
8Set Spin
Spin
crystalSpin.value
9Generate Random Number
Action Name
crystalFall
Minimum
@self.slowestFall
Maximum
@self.fastestFall
10Set Velocity
X Velocity
0
Y Velocity
-crystalFall.value
When Leaving the View
WhenLeave View
1Generate Random Number
Action Name
crystalX
Minimum
@self.leftmost
Maximum
@self.rightmost
2Set Position
X
crystalX.value
Y
@self.topStart
3Generate Random Integer
Action Name
newColorRow
Maximum
dataCount('Piece Kinds') - 1
4Set Frame
Frame
data('Piece Kinds', newColorRow.value, 'frame')
ObjectDrifting Crystal
Sprite
Scene Depth Draw Order-40
SpriteCrystal Blocks
Transform > SizeX 1.5, Y 1.5
Logic
Drift Down

Place the Gameplay bubbles from the setup’s first Scene list. Leave its BACK TO MENU Objects for later. The Main Menu and Title have their own bubble and crystal lists near their ends. Place those as well, keeping their world positions.

Run Title and watch the rising bubbles pass crystals that are falling toward the bottom of the view. The rest of that Scene is still empty. Its invitation comes next.

7.5 The Invitation

The logo stands still while the words beneath it breathe.

7.5.2 Go To The Main Menu

The first press needs somewhere to go. Go To The Main Menu plays the selection sound and fades to that Scene. Go To The Title returns.

Both Scenes must exist before their names appear in Go to Scene. These Functions have no returned value. They leave the current Scene and bring another Scene into view, carrying the player between the two.

FunctionGo To The Main Menu

Leaves the Title for the Main Menu ("Menu Select", fading 0.4 s).

ACTIONS
1Control Sound
Sound
Menu Select
2Go to Scene
Scene
Main Menu
Transition
Fade
FunctionGo To The Title

Leaves the Main Menu for the Title ("Menu Back", fading 0.4 s).

ACTIONS
1Control Sound
Sound
Menu Back
2Go to Scene
Scene
Title
Transition
Fade

7.5.3 Title Controls

The invitation now answers. Title Controls gives Menus the keys and starts Aurora Glass as the Scene begins. Confirm and a left click share the same Function, so either opens the Main Menu.

The invisible Title Flow carries this Logic. Place it using its Title line; its position has no picture to move. The Main Menu may still look empty when you enter it. We’ll furnish it now.

Logic ComponentTitle ControlsAttach to: Title Flow

The Title's keys: the menus have the controls; Confirm or a left click goes to the Main Menu. Starts the Menu Theme.

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
musicFadeSecondsNumberConstant0.5
When the Scene Starts
WhenScene Start
1Set Input Context Active
Input Context
Menus
2Set Input Context Active
Input Context
Play
Active
No
3Control Sound
Operation
Crossfade Music
Sound
Aurora Glass (Menu Theme)
Crossfade Seconds
@self.musicFadeSeconds
When Confirm Is Pressed
WhenCommand PressedCommand: Confirm
1Go To The Main MenuFunction
When the Left Mouse Button Is Pressed
WhenMouse PressMouse button: left
1Go To The Main MenuFunction
ObjectTitle Flow
Logic
Title Controls

The invitation pulses against the moving sky, and your press opens the room you are about to furnish.

7.6 A Panel with Several Choices

The Main Menu uses the results panel’s memory.

Add choiceCount to the existing Panel State, beside the field that already remembers the chosen button. Each button will count itself when created, so the panel knows how far the selection can travel. Keep the existing chosen and isOpen fields.

Data StructurePanel StateAddDelete

What a panel of choices keeps: chosen, the choice chosen now (0 = the top one); isOpen, the panel is open and its choices can be chosen. choiceCount: how many choices it has (each choice adds itself when created).

chosenNumberdefault 0
isOpenBooleandefault false
choiceCountNumberdefault 0

7.6.1 Close How To Play

Make the return from help before the Events that call it. The pictures arrive later, but their controls will already have a way home. Close How To Play supplies that shared return.

FunctionClose How To Play

Closes the How to Play panel with "Menu Back" (howToPlayClosed).

ACTIONS
1Control Sound
Sound
Menu Back
2Trigger Custom Event
Custom Event
howToPlayClosed

7.6.2 Panel Choices

Up and Down now travel through the choices instead of always returning to PLAY AGAIN. At either end, the next press wraps around. The mod expression wraps it.

Add both navigation Events and their normal Modes first. Give each Event another Mode named While Help Is Open, and leave the Actions inside that Mode empty. The help messages choose between those responses. An empty Mode deliberately leaves the menu still while the player reads the help panel above it.

Logic ComponentPanel ChoicesAttach to: Results Panel, Main Menu FlowAddDelete

A panel of choices: opens on its chosen choice when told (panelOpened; the top one unless the Logic that opens it chose another), closes when told (panelClosed), going back to its top choice, and while open Up / Down choose the choice above or below, going round at either end, with Menu Bubble.

Attach toAny Object
DATA STRUCTURES
Panel Stateself.panelState
On Panel Opened
WhenpanelOpenedCustom Event
1Change Component Value
Component Value
self.panelState.isOpen
Value
true
2Choose Panel ChoiceFunction
panel
self
choice
self.panelState.chosen
On Panel Closed
WhenpanelClosedCustom Event
1Change Component Value
Component Value
self.panelState.isOpen
Value
false
2Change Component Value
Component Value
self.panelState.chosen
Value
0
3Trigger Custom Event
Custom Event
panelChoiceChanged
When Menu Navigate Up Is Pressed
When2D Direction PressedCommand: Menu NavigateDirection: Up
ModeChoose The One Above (Starting Mode)
1Ifself.panelState.isOpen == true
Then
2Choose Panel ChoiceFunction
panel
self
choice
mod(self.panelState.chosen - 1 + self.panelState.choiceCount, self.panelState.choiceCount)
3Control Sound
Sound
Menu Bubble
When Menu Navigate Down Is Pressed
When2D Direction PressedCommand: Menu NavigateDirection: Down
ModeChoose The One Below (Starting Mode)
1Ifself.panelState.isOpen == true
Then
2Choose Panel ChoiceFunction
panel
self
choice
mod(self.panelState.chosen + 1, self.panelState.choiceCount)
3Control Sound
Sound
Menu Bubble

Now let the help messages choose the quiet navigation Modes. Your choice waits.

Logic ComponentPanel ChoicescontinuedAddDelete
On How to Play Opened
WhenhowToPlayOpenedCustom Event
1Switch Mode
Event
When Menu Navigate Up Is Pressed
Mode
While Help Is Open
2Switch Mode
Event
When Menu Navigate Down Is Pressed
Mode
While Help Is Open
On How to Play Closed
WhenhowToPlayClosedCustom Event
1Switch Mode
Event
When Menu Navigate Up Is Pressed
Mode
Choose The One Above
2Switch Mode
Event
When Menu Navigate Down Is Pressed
Mode
Choose The One Below
WhenWhen Menu Navigate Up Is Pressed(the same Event)
ModeWhile Help Is Open (no blocks: it does nothing)
WhenWhen Menu Navigate Down Is Pressed(the same Event)
ModeWhile Help Is Open (no blocks: it does nothing)

7.6.3 Panel Choice

Each button registers with its panel when created. Keep the prepared declaration from Chapter 6, including the Object Kind restriction on the panel reference. It accepts Objects with Panel State. It accepts either Results Panel or Main Menu Flow, because both carry that structure.

The prepared declaration includes the panelState slot and its Panel State schema. Keep those names. Later, each button’s Shared Variable value chooses the actual panel resource.

The Confirm Event now has two responses. In Run If Chosen, it announces choiceRun as before. In While Help Is Open, it closes help only for the selected choice. The mouse Events get empty help Modes too.

One press opens help. The next press closes it. Keeping those responses in the same Event prevents the opening press from reaching a separate closing listener.

Logic ComponentPanel ChoiceAttach to: PLAY AGAIN Button, MARATHON Button, SPRINT 40 Button, ULTRA Button, ZEN Button, HOW TO PLAY Button, QUIT Button, BACK TO MENU ButtonAddDelete

One choice of a panel: while the panel is open, Confirm runs it when it is the chosen choice; the mouse over it chooses it, and a click on it runs it. Running it plays Menu Select and tells its own button (choiceRun), whose other Logic does the work of the choice. While the How to Play panel covers the Main Menu, the choices do nothing, and Confirm on the chosen one closes it.

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
panelObjectConstantNone
choiceNumberConstant0
OBJECT KINDS
panelObjects with Panel State
When Created
WhenCreate
1Change Component Value
Component Value
@self.panel.panelState.choiceCount
Operator
+=
Value
1
When Confirm Is Pressed
WhenCommand PressedCommand: Confirm
ModeRun If Chosen (Starting Mode)
1If@self.panel.panelState.isOpen == true && @self.panel.panelState.chosen == @self.choice
Then
2Control Sound
Sound
Menu Select
3Trigger Custom Event on Object
Custom Event
choiceRun
On Mouse Enter
WhenMouse Enter
ModeChoose This One (Starting Mode)
1If@self.panel.panelState.chosen != @self.choice
Then
2Choose Panel ChoiceFunction
panel
@self.panel
choice
@self.choice
3Control Sound
Sound
Menu Bubble
When Left Is Clicked
WhenMouse Pressed on ObjectMouse button: left
ModeRun This One (Starting Mode)
1Choose Panel ChoiceFunction
panel
@self.panel
choice
@self.choice
2Control Sound
Sound
Menu Select
3Trigger Custom Event on Object
Custom Event
choiceRun

The second part gives help its closing press. Restore the normal Modes when help closes, so these buttons can run their own jobs again.

Logic ComponentPanel Choice, SPRINT 40 Button, ULTRA Button, ZEN Button, HOW TO PLAY Button, QUIT Button, BACK TO MENU ButtoncontinuedAddDelete
On How to Play Opened
WhenhowToPlayOpenedCustom Event
1Switch Mode
Event
When Confirm Is Pressed
Mode
While Help Is Open
2Switch Mode
Event
On Mouse Enter
Mode
While Help Is Open
3Switch Mode
Event
When Left Is Clicked
Mode
While Help Is Open
On How to Play Closed
WhenhowToPlayClosedCustom Event
1Switch Mode
Event
When Confirm Is Pressed
Mode
Run If Chosen
2Switch Mode
Event
On Mouse Enter
Mode
Choose This One
3Switch Mode
Event
When Left Is Clicked
Mode
Run This One
When Confirm Is Pressed
WhenCommand PressedCommand: Confirm
ModeWhile Help Is Open
1If@self.panel.panelState.chosen == @self.choice
Then
2Close How To PlayFunction
WhenOn Mouse Enter(the same Event)
ModeWhile Help Is Open (no blocks: it does nothing)
WhenWhen Left Is Clicked(the same Event)
ModeWhile Help Is Open (no blocks: it does nothing)

7.7 Give Each Choice Its Job

The glow can choose a button before the game knows what that button does.

Make Menu Choices Entry, then Menu Choices. Each row holds the mode number and the words that appear beside that choice when its button glows. The help and quit rows use no playing mode. Keep the rows in the card’s order, because menuChoice is their row number.

Data StructureMenu Choices Entry

One row of the "Menu Choices" Data Table. Its fields are the columns of the table. The Main Menu's choices, top to bottom; the row number is $menuChoice. mode: the way to play it starts (1 Marathon, 2 Sprint 40, 3 Ultra, 4 Zen; 0 for HOW TO PLAY and QUIT). title, line1, line2, line3: what the info panel says about it, a line each.

modeNumberdefault 0
titleTextdefault (empty)
line1Textdefault (empty)
line2Textdefault (empty)
line3Textdefault (empty)
Data TableMenu ChoicesData Structure: Menu Choices Entry
Row 0MARATHON
mode1
titleMARATHON
line1Clear lines to climb 15 levels of
line2rising speed. Reach 150 lines to win.
line3
Row 1SPRINT 40
mode2
titleSPRINT 40
line1Clear 40 lines as fast as you can.
line2Your best time is saved.
line3
Row 2ULTRA
mode3
titleULTRA
line1Two minutes. Score as much as you can:
line2Cascades, Twists, combos and
line3Back-to-Back chains pay the most.
Row 3ZEN
mode4
titleZEN
line1No clock, no game over, gentle gravity.
line2Build calmly - a full well simply
line3sparkles clean and play goes on.
Row 4HOW TO PLAY
mode0
titleHOW TO PLAY
line1Controls, scoring and the
line2modern rules this game follows.
line3
Row 5QUIT
mode0
titleQUIT
line1Leave Crystal Cascade.
line2See you soon!
line3

7.7.1 Start The Chosen Mode

A mode button reads its row into mode before leaving for Gameplay. Each playing button shares this job. Each row holds the mode that distinguishes this button from the other playing choices.

These choices can already enter the well. Their separate finish lines and personal bests arrive in Chapter 8. The descriptions beside those buttons are promises we’ll keep when the well learns what each mode asks for.

Logic ComponentStart The Chosen ModeAttach to: MARATHON Button, SPRINT 40 Button, ULTRA Button, ZEN Button

What a mode choice (MARATHON, SPRINT 40, ULTRA, ZEN) does: starts a game of the mode of the chosen choice (Menu Choices): keeps it in $mode and goes to the Gameplay Scene.

Attach toAny Object
On Choice Run
WhenchoiceRunCustom Event
1Change Variable
Variable
$mode
Value
data('Menu Choices', $menuChoice, 'mode')
2Go to Scene
Scene
Gameplay
Transition
Fade
Transition Seconds
0.5

7.7.2 Open How To Play

HOW TO PLAY stays in this Scene. The selected button opens a controls chart over the menu. Its pictures will arrive below; Open How To Play connects their opening to the controls that must wait underneath.

The supplied menu description mentions scoring and rules, but this help panel shows the controls chart. The scoring rules stay in Chapter 5. You can give this row your own description in the Challenge.

Logic ComponentOpen How To PlayAttach to: HOW TO PLAY Button

What the HOW TO PLAY choice does: opens the How to Play panel (howToPlayOpened).

Attach toAny Object
On Choice Run
WhenchoiceRunCustom Event
1Trigger Custom Event
Custom Event
howToPlayOpened

7.7.3 Quit The Game

QUIT ends play through End Game. A native game can close its window; a browser game stops within its page. The surrounding webpage stays where it is.

Logic ComponentQuit The GameAttach to: QUIT Button

What the QUIT choice does: ends the game. End Game closes the window (or stops the published game in a browser).

Attach toAny Object
On Choice Run
WhenchoiceRunCustom Event
1End Game

Make the choice Objects now. The bright picture uses Show When Panel Choice from Chapter 6. Its panel reference names Main Menu Flow, and the choice number identifies which button should receive that glow. The button uses Panel Choice and the listener for its job.

Compare panel, choice, attached job and placement first. Those values distinguish the otherwise familiar cards. Keep Shared Variables on the button separate from Per Instance Variables on its glow.

ObjectMARATHON Highlight
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order101
SpriteAero Button Lit
Transform > SizeX 522.75, Y 91.8
Logic
Show When Panel Choice
Shared Variables
panelMain Menu Flow
ObjectMARATHON Button
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order100
SpriteAero Button
Transform > SizeX 522.75, Y 91.8
Collider
CollisionSensor
Shape and Transform > SizeX 498.75, Y 70.8
Logic
Panel Choice
Start The Chosen Mode
Shared Variables
panelMain Menu Flow
ObjectMARATHON Label
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 48
Text / UI
TextMARATHON
FontNunito
Font Size42
EmphasisBold
Letter Spacing1.5
AlignmentCenter
Text BoundsWrap to Width
Transform > Size X522.75
ObjectSPRINT 40 Highlight
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order101
SpriteAero Button Lit
Transform > SizeX 522.75, Y 91.8
Logic
Show When Panel Choice
Shared Variables
panelMain Menu Flow
Per Instance Variables
choice1
ObjectSPRINT 40 Button
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order100
SpriteAero Button
Transform > SizeX 522.75, Y 91.8
Collider
CollisionSensor
Shape and Transform > SizeX 498.75, Y 70.8
Logic
Panel Choice
Start The Chosen Mode
Shared Variables
panelMain Menu Flow
choice1
ObjectSPRINT 40 Label
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 48
Text / UI
TextSPRINT 40
FontNunito
Font Size42
EmphasisBold
Letter Spacing1.5
AlignmentCenter
Text BoundsWrap to Width
Transform > Size X522.75
ObjectULTRA Highlight
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order101
SpriteAero Button Lit
Transform > SizeX 522.75, Y 91.8
Logic
Show When Panel Choice
Shared Variables
panelMain Menu Flow
Per Instance Variables
choice2
ObjectULTRA Button
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order100
SpriteAero Button
Transform > SizeX 522.75, Y 91.8
Collider
CollisionSensor
Shape and Transform > SizeX 498.75, Y 70.8
Logic
Panel Choice
Start The Chosen Mode
Shared Variables
panelMain Menu Flow
choice2
ObjectULTRA Label
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 48
Text / UI
TextULTRA
FontNunito
Font Size42
EmphasisBold
Letter Spacing1.5
AlignmentCenter
Text BoundsWrap to Width
Transform > Size X522.75
ObjectZEN Highlight
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order101
SpriteAero Button Lit
Transform > SizeX 522.75, Y 91.8
Logic
Show When Panel Choice
Shared Variables
panelMain Menu Flow
Per Instance Variables
choice3
ObjectZEN Button
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order100
SpriteAero Button
Transform > SizeX 522.75, Y 91.8
Collider
CollisionSensor
Shape and Transform > SizeX 498.75, Y 70.8
Logic
Panel Choice
Start The Chosen Mode
Shared Variables
panelMain Menu Flow
choice3
ObjectZEN Label
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 48
Text / UI
TextZEN
FontNunito
Font Size42
EmphasisBold
Letter Spacing1.5
AlignmentCenter
Text BoundsWrap to Width
Transform > Size X522.75
ObjectHOW TO PLAY Highlight
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorBottom Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order101
SpriteAero Button Lit
Transform > SizeX 522.75, Y 91.8
Logic
Show When Panel Choice
Shared Variables
panelMain Menu Flow
Per Instance Variables
choice4
ObjectHOW TO PLAY Button
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorBottom Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order100
SpriteAero Button
Transform > SizeX 522.75, Y 91.8
Collider
CollisionSensor
Shape and Transform > SizeX 498.75, Y 70.8
Logic
Panel Choice
Open How To Play
Shared Variables
panelMain Menu Flow
choice4
ObjectHOW TO PLAY Label
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorBottom Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 48
Text / UI
TextHOW TO PLAY
FontNunito
Font Size42
EmphasisBold
Letter Spacing1.5
AlignmentCenter
Text BoundsWrap to Width
Transform > Size X522.75
ObjectQUIT Highlight
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorBottom Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order101
SpriteAero Button Lit
Transform > SizeX 522.75, Y 91.8
Logic
Show When Panel Choice
Shared Variables
panelMain Menu Flow
Per Instance Variables
choice5
ObjectQUIT Button
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorBottom Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order100
SpriteAero Button
Transform > SizeX 522.75, Y 91.8
Collider
CollisionSensor
Shape and Transform > SizeX 498.75, Y 70.8
Logic
Panel Choice
Quit The Game
Shared Variables
panelMain Menu Flow
choice5
ObjectQUIT Label
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorBottom Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 48
Text / UI
TextQUIT
FontNunito
Font Size42
EmphasisBold
Letter Spacing1.5
AlignmentCenter
Text BoundsWrap to Width
Transform > Size X522.75

Place these groups in the Main Menu list’s order. The buttons carry the Collider sensors that hear the mouse, while their labels and bright pictures sit above them. Keep those layers together. Move Up and Down and watch one glow travel through the menu.

7.8 Words Beside the Choice

The right-hand panel follows what you choose.

Make Menu Info Text. Each of its text Objects gets one plain Data Structure component, named shown. As with the results record, add and name it before attaching Show Menu Info. Its template reads infoText from that component.

Data StructureMenu Info Text

What a text of the info panel shows. infoText: its column of Menu Choices for the chosen choice (its template {infoText} reads it).

infoTextTextdefault (empty)

7.8.1 Show Menu Info

One choice changes several lines at once. Show Menu Info reads the chosen row, with a different column on each text Object. The title takes title; the lines take line1, line2 and line3.

An empty field hides that text. The menu can describe a choice in fewer lines without leaving old words beneath it. Keep the same Logic on all four Objects and set their column values from their cards.

Logic ComponentShow Menu InfoAttach to: Info Title, Info Line 1, Info Line 2, Info Line 3

One text of the info panel of the Main Menu: shows its column (title, line1, line2 or line3) of Menu Choices for the chosen choice, in the Menu Info Text field infoText that its template reads.

Attach toAny Object
DATA STRUCTURES
Menu Info Textself.shown
SHARED VARIABLES
NameTypeKindStarting Value
columnTextConstanttitle
On Menu Choice Changed
WhenmenuChoiceChangedCustom Event
1Change Component Value
Component Value
self.shown.infoText
Value
data('Menu Choices', global('menuChoice'), @self.column)
2Ifself.shown.infoText != ""
Then
3Set Visible
Visible
Yes
4Otherwise
5Set Visible
Visible
No
ObjectInfo Panel
Sprite
Scene Depth Draw Order-10
SpriteInfo Glass Panel
Transform > SizeX 21.5625, Y 17.8125
ObjectInfo Title
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 48
Text / UI
Text{infoText}
FontNunito
Font Size60
EmphasisBold
Letter Spacing1.5
AlignmentCenter
Text BoundsWrap to Width
Transform > Size X630
Data Structure
Data StructureMenu Info Text
Logic
Show Menu Info
ObjectInfo Line 1
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 48
Text / UI
Text{infoText}
FontNunito
Font Size31.5
Color#E4F8FF
Letter Spacing1.5
AlignmentCenter
Text BoundsWrap to Width
Transform > Size X645
Data Structure
Data StructureMenu Info Text
Logic
Show Menu Info
Shared Variables
columnline1
ObjectInfo Line 2
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 48
Text / UI
Text{infoText}
FontNunito
Font Size31.5
Color#E4F8FF
Letter Spacing1.5
AlignmentCenter
Text BoundsWrap to Width
Transform > Size X645
Data Structure
Data StructureMenu Info Text
Logic
Show Menu Info
Shared Variables
columnline2
ObjectInfo Line 3
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 48
Text / UI
Text{infoText}
FontNunito
Font Size31.5
Color#E4F8FF
Letter Spacing1.5
AlignmentCenter
Text BoundsWrap to Width
Transform > Size X645
Data Structure
Data StructureMenu Info Text
Logic
Show Menu Info
Shared Variables
columnline3

The START LEVEL group reads startLevel directly. Show When Panel Choice keeps that group visible only for MARATHON. The arrows are pictures of keyboard keys; Main Menu Controls hears the keys themselves.

ObjectStart Level Label
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 48
Text / UI
TextSTART LEVEL
FontNunito
Font Size39
EmphasisBold
Color#FFF3B0
Letter Spacing1.5
AlignmentCenter
Text BoundsWrap to Width
Transform > Size X306
Logic
Show When Panel Choice
Shared Variables
panelMain Menu Flow
ObjectStart Level Left Key
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order120
SpriteKey Left
Transform > SizeX 51, Y 51
Logic
Show When Panel Choice
Shared Variables
panelMain Menu Flow
ObjectStart Level Value
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 48
Text / UI
Text{$startLevel}
FontNunito
Font Size39
EmphasisBold
Color#FFF3B0
Letter Spacing1.5
AlignmentCenter
Text BoundsWrap to Width
Transform > Size X84
Logic
Show When Panel Choice
Shared Variables
panelMain Menu Flow
ObjectStart Level Right Key
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order120
SpriteKey Right
Transform > SizeX 51, Y 51
Logic
Show When Panel Choice
Shared Variables
panelMain Menu Flow

Place the info panel, its four texts and the level group from the next setup lines. Choose another button, then return to MARATHON. The words should change with your choice, and the level selector should disappear until MARATHON is chosen again.

7.9 Help Over the Menu

The help panel borrows the space above the choices.

7.9.1 Show With Help

A key picture and its explanation need to appear together. Show With Help gives all the help Objects the same opening and closing messages. The veil uses its own shownAlpha override, letting the menu remain faintly visible behind it.

Logic ComponentShow With HelpAttach to: Help Veil, Help Panel, Help Title, Help Keys 0-0 0, Help Keys 0-0 1, Help Action 0-0, Help Keys 0-1 0, Help Action 0-1, Help Keys 0-2 0, Help Action 0-2, Help Keys 0-3 0, Help Keys 0-3 1, Help Action 0-3, Help Keys 1-0 0, Help Keys 1-0 1, Help Action 1-0, Help Keys 1-1 0, Help Keys 1-1 1, Help Action 1-1, Help Keys 1-2 0, Help Action 1-2, Help Keys 1-3 0, Help Keys 1-3 1, Help Action 1-3, Help Back 0, Help Back 1, Help Back 2, Help Back 3

One part of the How to Play panel: hidden while the menu is open, shown at shownAlpha while the panel is open.

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
shownAlphaNumberConstant1
When Created
WhenCreate
1Set Visible
Visible
No
On How to Play Opened
WhenhowToPlayOpenedCustom Event
1Set Alpha
Alpha
@self.shownAlpha
2Set Visible
Visible
Yes
On How to Play Closed
WhenhowToPlayClosedCustom Event
1Set Visible
Visible
No

7.9.2 Hide With Help

The small menu hints would compete with help’s closing hints. Hide With Help puts them away while the larger panel is open, then returns them when it closes. It leaves the menu’s selection intact.

Logic ComponentHide With HelpAttach to: Menu Hint Up Key, Menu Hint Down Key, Menu Hint CHOOSE, Menu Hint Enter Key, Menu Hint PLAY, Menu Hint Esc Key, Menu Hint BACK

A part of the menu hidden while the How to Play panel is open (the key hints along the bottom).

Attach toAny Object
On How to Play Opened
WhenhowToPlayOpenedCustom Event
1Set Visible
Visible
No
On How to Play Closed
WhenhowToPlayClosedCustom Event
1Set Visible
Visible
Yes

Make the menu’s bottom key hints with Hide With Help attached. The Title invitation used this pattern. Place them before the help group in the setup list.

ObjectMenu Hint Up Key
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorBottom Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order130
SpriteKey Up
Transform > SizeX 43.2, Y 43.2
Logic
Hide With Help
ObjectMenu Hint Down Key
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorBottom Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order130
SpriteKey Down
Transform > SizeX 43.2, Y 43.2
Logic
Hide With Help
ObjectMenu Hint CHOOSE
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorBottom Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 48
Text / UI
TextCHOOSE
FontNunito
Font Size25.5
EmphasisBold
Letter Spacing1.5
AlignmentCenter
Text BoundsWrap to Width
Transform > Size X139.5
Logic
Hide With Help
ObjectMenu Hint Enter Key
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorBottom Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order130
SpriteKey Enter
Transform > SizeX 82.08, Y 43.2
Logic
Hide With Help
ObjectMenu Hint PLAY
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorBottom Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 48
Text / UI
TextPLAY
FontNunito
Font Size25.5
EmphasisBold
Letter Spacing1.5
AlignmentCenter
Text BoundsWrap to Width
Transform > Size X91.5
Logic
Hide With Help
ObjectMenu Hint Esc Key
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorBottom Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order130
SpriteKey Esc
Transform > SizeX 60.48, Y 43.2
Logic
Hide With Help
ObjectMenu Hint BACK
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorBottom Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 48
Text / UI
TextBACK
FontNunito
Font Size25.5
EmphasisBold
Letter Spacing1.5
AlignmentCenter
Text BoundsWrap to Width
Transform > Size X97.5
Logic
Hide With Help

Now make the help background. The veil dims what lies beneath; the panel holds the controls. Show With Help starts each of these Objects hidden, ready for the message the HOW TO PLAY button sends.

ObjectHelp Veil
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order150
SpriteWhite Pixel
Tint#04284A
Transform > SizeX 1920, Y 1080
Logic
Show With Help
Shared Variables
shownAlpha0.82
ObjectHelp Panel
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order151
SpriteLarge Glass Panel
Transform > SizeX 1350, Y 600
Logic
Show With Help
ObjectHelp Title
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorTop Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 48
Text / UI
TextHOW TO PLAY
FontNunito
Font Size57
EmphasisBold
Letter Spacing1.5
AlignmentCenter
Text BoundsWrap to Width
Transform > Size X900
Logic
Show With Help

The help rows reuse the same layout. Each row has key pictures followed by the action they perform. The numbers in these Object names identify the column, row and key picture. Keep their names.

Compare the Sprite resource, anchor, key size and matching placement on each key card. Compare Text on each action card. The rest repeats the style you have already built. Each Object carries Show With Help, so the complete control chart appears together.

ObjectHelp Keys 0-0 0
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order155
SpriteKey Left
Transform > SizeX 51, Y 51
Logic
Show With Help
ObjectHelp Keys 0-0 1
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order155
SpriteKey Right
Transform > SizeX 51, Y 51
Logic
Show With Help
ObjectHelp Action 0-0
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 48
Text / UI
TextMOVE
FontNunito
Font Size31.5
EmphasisBold
Letter Spacing1.5
Text BoundsWrap to Width
Transform > Size X300
Logic
Show With Help
ObjectHelp Keys 0-1 0
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order155
SpriteKey Down
Transform > SizeX 51, Y 51
Logic
Show With Help
ObjectHelp Action 0-1
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 48
Text / UI
TextSOFT DROP
FontNunito
Font Size31.5
EmphasisBold
Letter Spacing1.5
Text BoundsWrap to Width
Transform > Size X300
Logic
Show With Help
ObjectHelp Keys 0-2 0
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order155
SpriteKey Space
Transform > SizeX 158.1, Y 51
Logic
Show With Help
ObjectHelp Action 0-2
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 48
Text / UI
TextHARD DROP
FontNunito
Font Size31.5
EmphasisBold
Letter Spacing1.5
Text BoundsWrap to Width
Transform > Size X300
Logic
Show With Help
ObjectHelp Keys 0-3 0
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order155
SpriteKey C
Transform > SizeX 51, Y 51
Logic
Show With Help
ObjectHelp Keys 0-3 1
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order155
SpriteKey Shift
Transform > SizeX 91.8, Y 51
Logic
Show With Help
ObjectHelp Action 0-3
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 48
Text / UI
TextHOLD
FontNunito
Font Size31.5
EmphasisBold
Letter Spacing1.5
Text BoundsWrap to Width
Transform > Size X300
Logic
Show With Help
ObjectHelp Keys 1-0 0
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order155
SpriteKey Up
Transform > SizeX 51, Y 51
Logic
Show With Help
ObjectHelp Keys 1-0 1
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order155
SpriteKey X
Transform > SizeX 51, Y 51
Logic
Show With Help
ObjectHelp Action 1-0
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 48
Text / UI
TextROTATE RIGHT
FontNunito
Font Size31.5
EmphasisBold
Letter Spacing1.5
Text BoundsWrap to Width
Transform > Size X300
Logic
Show With Help
ObjectHelp Keys 1-1 0
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order155
SpriteKey Z
Transform > SizeX 51, Y 51
Logic
Show With Help
ObjectHelp Keys 1-1 1
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order155
SpriteKey Ctrl
Transform > SizeX 79.05, Y 51
Logic
Show With Help
ObjectHelp Action 1-1
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 48
Text / UI
TextROTATE LEFT
FontNunito
Font Size31.5
EmphasisBold
Letter Spacing1.5
Text BoundsWrap to Width
Transform > Size X300
Logic
Show With Help
ObjectHelp Keys 1-2 0
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order155
SpriteKey A
Transform > SizeX 51, Y 51
Logic
Show With Help
ObjectHelp Action 1-2
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 48
Text / UI
TextROTATE 180
FontNunito
Font Size31.5
EmphasisBold
Letter Spacing1.5
Text BoundsWrap to Width
Transform > Size X300
Logic
Show With Help
ObjectHelp Keys 1-3 0
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order155
SpriteKey Esc
Transform > SizeX 71.4, Y 51
Logic
Show With Help
ObjectHelp Keys 1-3 1
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order155
SpriteKey P
Transform > SizeX 51, Y 51
Logic
Show With Help
ObjectHelp Action 1-3
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 48
Text / UI
TextPAUSE
FontNunito
Font Size31.5
EmphasisBold
Letter Spacing1.5
Text BoundsWrap to Width
Transform > Size X300
Logic
Show With Help

The last help row offers the ways back. It uses the same visibility Logic as the control chart. Make these Objects and finish the help placements, including their draw orders.

ObjectHelp Back 0
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorBottom Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order155
SpriteKey Enter
Transform > SizeX 85.5, Y 45
Logic
Show With Help
ObjectHelp Back 1
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorBottom Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 48
Text / UI
Text/
FontNunito
Font Size27
EmphasisBold
Letter Spacing1.5
AlignmentCenter
Text BoundsWrap to Width
Transform > Size X27
Logic
Show With Help
ObjectHelp Back 2
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorBottom Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order155
SpriteKey Esc
Transform > SizeX 63, Y 45
Logic
Show With Help
ObjectHelp Back 3
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorBottom Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 48
Text / UI
TextBACK
FontNunito
Font Size27
EmphasisBold
Letter Spacing1.5
AlignmentCenter
Text BoundsWrap to Width
Transform > Size X102
Logic
Show With Help

Open HOW TO PLAY. The panel covers the menu, and navigation rests underneath. Try its closing controls separately: Confirm on one visit, Back on another, then a right click on the next. The chosen button should still be waiting.

7.10 A Game Reached From the Menu

The well inherits a choice made outside Gameplay, before its falling piece has even been created.

7.10.1 Count Level

MARATHON begins at the level the menu chose. Count Level keeps that beginning in firstLevel, then counts cleared lines from there. Other modes still begin at the first level.

The change belongs at Scene Start, before Piece Gravity reads currentLevel for a new piece. Keep the existing counting Events and add the marked starting-level branch.

Logic ComponentCount LevelAttach to: Game RulesAddDelete

Raises the level (the Project Global currentLevel) by one for every linesPerLevel lines from the level the game started at ($firstLevel), up to the last row of Levels, and says so.

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
linesPerLevelNumberConstant10
lastLevelNumberConstant20
When the Scene Starts
WhenScene Start
1If$mode == 1
Then
2Change Variable
Variable
$firstLevel
Value
$startLevel
3Otherwise
4Change Variable
Variable
$firstLevel
Value
1
5Change Variable
Variable
$currentLevel
Value
$firstLevel
Value
1
On Lines Cleared
WhenlinesClearedCustom Event
1Declare Variable
Name
reachedLevel
Value
0
2Change Variable
Variable
reachedLevel
Value
global('firstLevel') + floor(global('lines') / @self.linesPerLevel)
Value
1 + floor(global('lines') / @self.linesPerLevel)
3IfreachedLevel > @self.lastLevel
Then
4Change Variable
Variable
reachedLevel
Value
@self.lastLevel
5IfreachedLevel > global('currentLevel')
Then
6Change Variable
Variable
$currentLevel
Value
reachedLevel
7Trigger Custom Event
Custom Event
levelUp
On Game Over
WhengameOverCustom Event
1Set Logic State
Logic Component
Count Level
State
Disable

7.10.2 Keep Bests

Gameplay is no longer the first Scene. Keep Bests therefore loads at Scene Start, whenever a game begins, instead of waiting for Game Start on this Object. The saved value has the same key as before.

Logic ComponentKeep BestsAttach to: Game RulesAddDelete

Reads the best score kept on this device into the Project Global bestMarathonScore when a game begins, and keeps a new best when the game ends.

Attach toAny Object
DATA STRUCTURES
Scoring Stateself.scoring
When the Scene Starts
WhenScene Start
When the Game Starts
WhenGame Start
1Load Persistent Value
Action Name
savedBest
Key
"bestMarathon"
Default
0
2Change Variable
Variable
$bestMarathonScore
Value
savedBest.value
On Game Over
WhengameOverCustom Event
1Ifglobal('score') > global('bestMarathonScore')
Then
2Change Variable
Variable
$bestMarathonScore
Value
global('score')
3Save Persistent Value
Action Name
savedBestWrite
Key
"bestMarathon"
Value
global('bestMarathonScore')
4Change Component Value
Component Value
self.scoring.isNewBest
Value
true

7.10.3 Game Music

The menu theme gives way to Crystal Current when the well appears. Game Music crossfades at Scene Start, so a new visit to Gameplay can make the same change. Attach it last on Game Rules as its card shows.

Logic ComponentGame MusicAttach to: Game Rules

Plays the Game Theme while a game is played.

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
musicFadeSecondsNumberConstant0.5
When the Scene Starts
WhenScene Start
1Control Sound
Operation
Crossfade Music
Sound
Crystal Current (Game Theme)
Crossfade Seconds
@self.musicFadeSeconds
ObjectGame RulesAddDelete
Data Structure
Data StructureScoring State
Logic
Count Lines
Score Points
Count Combo
Count Level
Keep Bests
Check Top Out
Open Results
Count Clears
Time The Game
Game Music
Shared Variables
wellGlass Well
pieceFalling Piece
resultsPanelResults Panel

7.10.4 Back To The Menu

The ending now has another destination. Back To The Menu fades from Gameplay to Main Menu. Leave The Results gives the results button that Function when it hears choiceRun.

FunctionBack To The Menu

Leaves the game for the Main Menu (fading 0.4 s).

ACTIONS
1Go to Scene
Scene
Main Menu
Transition
Fade

7.10.5 Leave The Results

PLAY AGAIN starts fresh in the same Scene. BACK TO MENU leaves it, so the next choice can happen somewhere else. Both buttons keep Panel Choice for the familiar mouse and keyboard behavior.

Logic ComponentLeave The ResultsAttach to: BACK TO MENU Button

What the BACK TO MENU choice of the results does: goes back to the Main Menu (Back To The Menu).

Attach toAny Object
On Choice Run
WhenchoiceRunCustom Event
1Back To The MenuFunction
ObjectBACK TO MENU Button
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorBottom Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order146
SpriteAero Button
Transform > SizeX 442.8, Y 77.76
Collider
CollisionSensor
Shape and Transform > SizeX 418.8, Y 56.76
Logic
Show With Results
Panel Choice
Leave The Results
Shared Variables
panelResults Panel
choice1
ObjectBACK TO MENU Highlight
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorBottom Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order147
SpriteAero Button Lit
Transform > SizeX 442.8, Y 77.76
Logic
Show When Panel Choice
Shared Variables
panelResults Panel
ObjectBACK TO MENU Label
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorBottom Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 48
Text / UI
TextBACK TO MENU
FontNunito
Font Size39
EmphasisBold
Letter Spacing1.5
AlignmentCenter
Text BoundsWrap to Width
Transform > Size X442.8
Logic
Show With Results

7.10.6 Open Results

Back also leaves the results panel. Add this listener alongside the delay that already opens it. Menus can hear Back now.

Logic ComponentOpen ResultsAttach to: Game RulesAddDelete

Opens the results panel resultsDelaySeconds after the game ends (resultsShown).

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
resultsDelaySecondsNumberConstant1.6
resultsPanelObjectConstantNone
OBJECT KINDS
resultsPanelObjects with Panel State
When the Scene Starts
WhenScene Start
1Set Input Context Active
Input Context
Play
2Set Input Context Active
Input Context
Menus
Active
No
On Game Over
WhengameOverCustom Event
1Start Recurring Timer
Timer Name
"resultsDelay"
Repeat Every (s)
@self.resultsDelaySeconds
Ring Once
Yes
On the Results Delay Timer
WhenRecurring TimerTimer name: resultsDelay
1Set Input Context Active
Input Context
Menus
2Set Input Context Active
Input Context
Play
Active
No
3Trigger Custom Event on Object
Applies to
@self.resultsPanel
Custom Event
panelOpened
4Trigger Custom Event
Custom Event
resultsShown
When Back Is Pressed
WhenCommand PressedCommand: Back
1Control Sound
Sound
Menu Back
2Back To The MenuFunction

Finish the Gameplay setup list with the BACK TO MENU group. It follows PLAY AGAIN. The updated Panel Choice counts both buttons when they are created.

Reference only: these full Object cards compare the gameplay parts you already built. Keep your existing Objects; no second copies belong here. Keep their existing names and attachments. Compare them if your menu journey leaves a gameplay picture behaving differently.

ObjectGlass Well
Sprite
Scene Depth Draw Order-10
SpriteGlass Well
Transform > SizeX 16.5, Y 31.5
Data Structure
Data StructureWell State
Data Structure
From LogicClear Full Lines
Data StructureClear Full Lines Data
Logic
Build The Well
Clear Full Lines
Shared Variables
wellCellWell Cell
pieceFalling Piece
ObjectWell Cell
Sprite
SpriteCrystal Blocks
Transform > SizeX 1.5, Y 1.5
Data Structure
From LogicShow Well Cell
Data StructureShow Well Cell Data
Logic
Show Well Cell
ObjectFalling Piece
Data Structure
Data StructurePiece
Data Structure
From LogicRead The Move Keys
Data StructureRead The Move Keys Data
Data Structure
From LogicSoft Drop Piece
Data StructureSoft Drop Piece Data
Data Structure
From LogicHold Piece
Data StructureHold Piece Data
Logic
Spawn Piece
Piece Gravity
Check Twist
Lock Piece
Read The Move Keys
Move Piece
Rotate Piece
Soft Drop Piece
Hard Drop Piece
Show Drop Streaks
Hold Piece
Shared Variables
streakDrop Streak
ObjectPiece Queue
Data Structure
From LogicDeal Pieces
Data StructureDeal Pieces Data
Logic
Deal Pieces
ObjectPreview Crystal
Sprite
Scene Depth Draw Order8
SpriteCrystal Blocks
Transform > SizeX 1.5, Y 1.5
Data Structure
From LogicShow Preview Crystal
Data StructureShow Preview Crystal Data
Logic
Show Preview Crystal
Shared Variables
pieceFalling Piece

7.11 Play It!

  • Start on Title. Watch the invitation dim and brighten, with bubbles rising and crystals falling behind the logo.
  • Press Enter to enter Main Menu. Use Back to return to Title, then try a left click on the invitation.
  • Move through every menu choice. The glow wraps around at both ends, while the info panel changes its words.
  • Select MARATHON. Left and Right change START LEVEL within its limits; another choice hides that group.
  • Open HOW TO PLAY. Up, Down and mouse movement leave the choice alone underneath it. Confirm, Back and a right click each close help on separate tries.
  • Choose MARATHON and play. End the game, then use BACK TO MENU. Your previous menu choice returns.
  • Choose a later start level for MARATHON and enter the well again. LEVEL begins there, with faster gravity.
  • Try the other mode buttons. They reach Gameplay now; their different goals come next.
  • Try QUIT last. The browser game stops within its frame. Reload the page to play again.

7.12 How It Works

The button chooses. Another listener gives that choice its meaning. A shared panel can therefore serve results and the Main Menu without learning every button’s job.

Help changes the response to an Event. It also changes the pictures, but the Modes are what keep hidden choices quiet. Closing help restores the same controls around the same remembered choice.

7.13 If It Didn’t Work

The menu shows but no key moves its glow? Start with the input context: Title Controls and Main Menu Controls must activate Menus before its Commands can be heard. The Commands must belong to that context. Restore the group, then enter the menu again and press Down.

Up and Down skip choices or stop wrapping? Compare Panel Choice’s Create Event and its panel value on every button. Each button counts itself on the same panel. Restore the missing reference and restart the Scene to count again.

Help opens and closes on one press? Keep the opening and closing responses in Modes of the same Confirm Event. A separate closing Event can hear the opening press too. Restore those Modes and try again.

A red self.shown name in Show Menu Info? Each info text needs its Menu Info Text component named shown before the Logic’s expressions read it. Add or rename that single component, attach the Logic, then retype the expression. The words have somewhere to arrive now.

A bubble leaves the view and never comes back up from below the screen? Look at its Leave View Event and bottomStart. Its upward velocity should remain set. Restore those values and wait for another passage through the sky.

The chosen start level disappears in Gameplay? Compare Count Level’s Scene Start branch and firstLevel assignment. Restore that boundary, return to MARATHON and choose the level again.

Still stuck? Search the manual, or ask in the Myth Engine Discord (opens a new tab).

7.14 Challenge

What would your game’s invitation look like? Try a different pulse, another arrangement of the key pictures, or words of your own in Menu Choices. Keep the working controls while you give the menu your own welcome.

The front door opens. Next, each way to play gets its own finish line.