Build a GameCreating Sky Ace

10  Title and Menus

Goal

Sky Ace gets its front door. The SKY ACE logo over the same ocean, your Fighter bobbing under it, and PRESS ENTER TO TAKE OFF blinking. A Main Menu with START MISSION, HOW TO PLAY and QUIT GAME. A PAUSED menu when you need a breath, and a high score that waits for you on the Title.

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

This chapter builds on Chapter 9’s game. Starting here? The catch-up download in Chapter 9’s Goal is that game, finished, ready to start from.

If your game and this chapter part ways, here is the chapter’s finished project. Open it and compare.

Sky Ace, Chapter 10 finishedZip of a Myth project · 4.2 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. Beside it, OFL.txt is the license of the project’s font, Bebas Neue.

10.1 The Idea

The sea slides down the middle of the screen, as it always has. Islands drift past, and a cloud. Over them, gold letters on a red banner say SKY ACE. Under the banner, a silver Fighter bobs gently, side to side and up and down, as if it were waiting for you.

The Title Theme plays. At the bottom, PRESS ENTER TO TAKE OFF blinks.

Press Enter. The screen fades, and the Main Menu opens over the same sea. START MISSION glows red. Press Down, and HOW TO PLAY glows instead.

Right now, though, your game has no front door at all: run it, and you’re in the middle of a mission, with the planes already coming. This chapter builds what comes before, and what comes after: the Title, the Main Menu, a pause, and a way home.

These are new places. A Scene is one place your game can be, with its own camera, its own sea and its own Objects. You’ve had one Scene since Chapter 1, Gameplay. This chapter adds two more, the Title and the Main Menu, and Go to Scene moves between them.

Each place needs its own controls, too. Space fires in a mission. On the Title it should take off, and on the menu it should choose. So the Commands get sorted into sets, one set for each place. Each set is an Input Context.

Think of a phone’s keyboard. The same keys type letters or numbers, depending on which set is showing.

The Main Menu brings one more new idea. Its three buttons are one Object, placed three times. What makes START MISSION start a mission, and QUIT GAME end the game? Each placement keeps its own number, its choice: 0, 1 or 2. Press Enter, and the chosen button calls one Function, Do What Was Chosen. It looks at the choice. Then it does that button’s job.

There’s a lot to place in this chapter, more than ever before. Much of it is pieces you know: words on the screen, a picture, a blink. Take it part by part.

At the end, your game is whole. In Chapter 1 your Fighter flew alone over an empty ocean. Now it has a front door.

10.2 The Plan

Here’s how the pieces work together. Read each line from left to right: it starts with something that happens in the game.

Most of these names are new to you. Read it once for its shape, and come back to it as each piece is built. It’s a map, not a test.

  • The game starts -> the Title opens, with only the Title controls on -> Title Music loops the Title Theme, and High Score reads the high score.
  • Enter on the Title -> Take Off calls Go to the Main Menu -> Go to Scene fades to the Main Menu.
  • The Main Menu opens -> Use Menu Controls switches the Menus controls on -> Main Menu Keys sets $menuChoice to 0, and Lit When Chosen lights START MISSION.
  • Down -> Main Menu Keys changes $menuChoice -> Lit When Chosen lights the next button.
  • Enter -> Main Menu Keys sends menuConfirmed -> the chosen button’s Menu Choice calls Do What Was Chosen.
  • HOW TO PLAY -> Open How to Play sends howToPlayOpened -> Show With How to Play shows the panel, and the keys and buttons switch to Reading How to Play.
  • START MISSION -> Start the Mission fades to Gameplay -> Use Flight Controls switches the Flight controls on, and Mission Music stops the Title Theme.
  • Esc in a mission -> Pause sends showPauseOverlay -> Pause Overlay Lifecycle pauses the game and shows PAUSED.
  • The mission is won -> Mission Over switches Return to Base on -> Enter calls Back to the Main Menu.

10.3 Set Up

This chapter uses nineteen more pictures and two more sounds. They’re in your project already.

The Set up card is the longest in the book. Each block goes with a part of this chapter, so don’t make it all now. COMMANDS and INPUT CONTEXTS come first, in the next part. GLOBAL VARIABLES and the two new Scenes come with the Title and the Main Menu. The How to Play placements have a part of their own, and the two Gameplay placements come in the last part.

Set upWhat this chapter adds
ART (sprites, from the starter kit)
Title Logo Art
Menu Button Art
Menu Button Lit Art
Key Up Icon
Key Down Icon
Large Panel Art
Key Left Icon
Key Right Icon
Key W Icon
Key A Icon
Key S Icon
Key D Icon
Key Space Icon
Key J Icon
Key B Icon
Key K Icon
Key Esc Icon
Key P Icon
Key Arrow Icon
SOUNDS (from the starter kit)
Menu Move
Title Theme
COMMANDS (Game Settings > Input Manager)
BackButton
KeybindingsEscape, Backspace
PauseButton
KeybindingsEscape, P
INPUT CONTEXTS (Game Settings > Input Manager)
TitleActive at Start(rename Default)
CommandsConfirm
MenusInactive at Start(new)
CommandsFly, Confirm, Back
FlightInactive at Start(new)
CommandsFly, Fire, Bomb, Pause, Confirm
GLOBAL VARIABLES
$menuChoiceNumberstarts at 0
SCENE Gameplay: PLACE THESE
ObjectXY
Main Menu Key48-172hidden
Main Menu Prompt138-172hidden
with Z-Index = 142
SCENETitle (new)
Camera Main CameraX 11.25, Y 18.75, view 22.5 x 30 m
View Main View720 x 960 pixels, Left 600, Bottom 60, camera Main Camera
BackgroundPacific Ocean
Background Color#0B3A5E
GAME SETTINGS > General > Startup
Start SceneTitle · 2D
SCENE Title: PLACE THESE
ObjectXY
Jungle Island17.54.781
Destroyer14.68817.438
Peak Island5.93828.063
Atoll3.43836.75
Carrier18.7545.375
Village Island6.87557.375
Cloud 117.529.375
Cloud 24.68817.5
Cloud 316.2510
Cloud 47.81340.625
Title Plane11.2514.688
Title Logo0-290
Title High Score0170
with Z-Index = 120
Take Off Press-141230
with Z-Index = 120
Take Off Key-39230
Take Off Words102230
with Z-Index = 120
Screen Frame00
Title Controls00
SCENEMain Menu (new)
Camera Main CameraX 11.25, Y 18.75, view 22.5 x 30 m
View Main View720 x 960 pixels, Left 600, Bottom 60, camera Main Camera
BackgroundPacific Ocean
Background Color#0B3A5E
SCENE Main Menu: PLACE THESE
ObjectXY
Jungle Island17.54.781
Destroyer14.68817.438
Peak Island5.93828.063
Atoll3.43836.75
Carrier18.7545.375
Village Island6.87557.375
Cloud 117.529.375
Cloud 24.68817.5
Cloud 316.2510
Cloud 47.81340.625
High Cloud6.2561.875
Menu Controls00
Menu Button060
Menu Button Lit060hidden
Menu Button Label058
with Z-Index = 104
Menu Button0-40
with Per Instance Variables > Choice = 1
Menu Button Lit0-40hidden
with Per Instance Variables > Choice = 1
Menu Button Label0-42
with Z-Index = 104
with Text / UI > Text = HOW TO PLAY (Edit Object Locally)
Menu Button0-140
with Per Instance Variables > Choice = 2
Menu Button Lit0-140hidden
with Per Instance Variables > Choice = 2
Menu Button Label0-142
with Z-Index = 104
with Text / UI > Text = QUIT GAME (Edit Object Locally)
Menu Logo0-210
Menu High Score0240
with Z-Index = 120
Choose Key Up-141298
Choose Key Down-105298
Choose Words-49298
with Z-Index = 120
Confirm Key45298
Confirm Words122298
with Z-Index = 120
Screen Frame00
How to Play Veil00hidden
How to Play Panel00hidden
How to Play Text0-172hidden
with Z-Index = 156
How to Play Text0-211hidden
with Z-Index = 156
with Text / UI > Text = PILOT QUICK GUIDE (Edit Object Locally)
with Text / UI > Font Size = 19 (Edit Object Locally)
with Text / UI > Color = #9FC3D8 (Edit Object Locally)
with Text / UI > Transform > Size X = 400 (Edit Object Locally)
How to Play Text50-255hidden
with Z-Index = 156
with Text / UI > Text = KEYBOARD CONTROLS (Edit Object Locally)
with Text / UI > Font Size = 20 (Edit Object Locally)
with Text / UI > Color = #9FC3D8 (Edit Object Locally)
with Text / UI > Transform > Size X = 360 (Edit Object Locally)
How to Play Strip0-317hidden
How to Play Text-238-317hidden
with Z-Index = 156
with Text / UI > Text = MOVE (Edit Object Locally)
with Text / UI > Font Size = 28 (Edit Object Locally)
with Text / UI > Color = #FFFFFF (Edit Object Locally)
with Text / UI > Transform > Size X = 90 (Edit Object Locally)
How to Play Strip0150hidden
with Screen Anchor = Center
with Sprite > Transform > Size = X 568, Y 56 (Edit Object Locally)
How to Play Text-238159hidden
with Screen Anchor = Center
with Z-Index = 156
with Text / UI > Text = FIRE (Edit Object Locally)
with Text / UI > Font Size = 28 (Edit Object Locally)
with Text / UI > Color = #FFFFFF (Edit Object Locally)
with Text / UI > Transform > Size X = 90 (Edit Object Locally)
How to Play Strip084hidden
with Screen Anchor = Center
with Sprite > Transform > Size = X 568, Y 56 (Edit Object Locally)
How to Play Text-23884hidden
with Screen Anchor = Center
with Z-Index = 156
with Text / UI > Text = BOMB (Edit Object Locally)
with Text / UI > Font Size = 28 (Edit Object Locally)
with Text / UI > Color = #FFFFFF (Edit Object Locally)
with Text / UI > Transform > Size X = 90 (Edit Object Locally)
How to Play Strip018hidden
with Screen Anchor = Center
with Sprite > Transform > Size = X 568, Y 56 (Edit Object Locally)
How to Play Text-23818hidden
with Screen Anchor = Center
with Z-Index = 156
with Text / UI > Text = PAUSE (Edit Object Locally)
with Text / UI > Font Size = 28 (Edit Object Locally)
with Text / UI > Color = #FFFFFF (Edit Object Locally)
with Text / UI > Transform > Size X = 90 (Edit Object Locally)
How to Play Text-238133hidden
with Screen Anchor = Center
with Z-Index = 156
with Text / UI > Text = HOLD (Edit Object Locally)
with Text / UI > Font Size = 16 (Edit Object Locally)
with Text / UI > Color = #9FC3D8 (Edit Object Locally)
with Text / UI > Transform > Size X = 90 (Edit Object Locally)
How to Play Key-50-298hidden
How to Play Key-88-335hidden
with Sprite > Sprite = Key Left Icon (Edit Object Locally)
How to Play Key-50-335hidden
with Sprite > Sprite = Key Down Icon (Edit Object Locally)
How to Play Key-12-335hidden
with Sprite > Sprite = Key Right Icon (Edit Object Locally)
How to Play Key150-298hidden
with Sprite > Sprite = Key W Icon (Edit Object Locally)
How to Play Key112-335hidden
with Sprite > Sprite = Key A Icon (Edit Object Locally)
How to Play Key150-335hidden
with Sprite > Sprite = Key S Icon (Edit Object Locally)
How to Play Key188-335hidden
with Sprite > Sprite = Key D Icon (Edit Object Locally)
How to Play Text50-317hidden
with Z-Index = 156
with Text / UI > Text = OR (Edit Object Locally)
with Text / UI > Font Size = 18 (Edit Object Locally)
with Text / UI > Color = #9FC3D8 (Edit Object Locally)
with Text / UI > Transform > Size X = 28 (Edit Object Locally)
How to Play Key-50150hidden
with Screen Anchor = Center
with Sprite > Sprite = Key Space Icon (Edit Object Locally)
with Sprite > Transform > Size = X 124, Y 40 (Edit Object Locally)
How to Play Key150150hidden
with Screen Anchor = Center
with Sprite > Sprite = Key J Icon (Edit Object Locally)
with Sprite > Transform > Size = X 40, Y 40 (Edit Object Locally)
How to Play Key-5084hidden
with Screen Anchor = Center
with Sprite > Sprite = Key B Icon (Edit Object Locally)
with Sprite > Transform > Size = X 40, Y 40 (Edit Object Locally)
How to Play Key15084hidden
with Screen Anchor = Center
with Sprite > Sprite = Key K Icon (Edit Object Locally)
with Sprite > Transform > Size = X 40, Y 40 (Edit Object Locally)
How to Play Key-5018hidden
with Screen Anchor = Center
with Sprite > Sprite = Key Esc Icon (Edit Object Locally)
with Sprite > Transform > Size = X 58, Y 40 (Edit Object Locally)
How to Play Key15018hidden
with Screen Anchor = Center
with Sprite > Sprite = Key P Icon (Edit Object Locally)
with Sprite > Transform > Size = X 40, Y 40 (Edit Object Locally)
How to Play Text50150hidden
with Screen Anchor = Center
with Z-Index = 156
with Text / UI > Text = OR (Edit Object Locally)
with Text / UI > Font Size = 18 (Edit Object Locally)
with Text / UI > Color = #9FC3D8 (Edit Object Locally)
with Text / UI > Transform > Size X = 28 (Edit Object Locally)
How to Play Text5084hidden
with Screen Anchor = Center
with Z-Index = 156
with Text / UI > Text = OR (Edit Object Locally)
with Text / UI > Font Size = 18 (Edit Object Locally)
with Text / UI > Color = #9FC3D8 (Edit Object Locally)
with Text / UI > Transform > Size X = 28 (Edit Object Locally)
How to Play Text5018hidden
with Screen Anchor = Center
with Z-Index = 156
with Text / UI > Text = OR (Edit Object Locally)
with Text / UI > Font Size = 18 (Edit Object Locally)
with Text / UI > Color = #9FC3D8 (Edit Object Locally)
with Text / UI > Transform > Size X = 28 (Edit Object Locally)
How to Play Text0-40hidden
with Screen Anchor = Center
with Z-Index = 156
with Text / UI > Text = PICKUPS (Edit Object Locally)
with Text / UI > Font Size = 30 (Edit Object Locally)
How to Play Pickup-249-85hidden
How to Play Text-133-85hidden
with Screen Anchor = Center
with Z-Index = 156
with Text / UI > Text = POWER UP (Edit Object Locally)
with Text / UI > Font Size = 24 (Edit Object Locally)
with Text / UI > Color = #FFB347 (Edit Object Locally)
with Text / UI > Alignment = Left (Edit Object Locally)
with Text / UI > Transform > Size X = 166 (Edit Object Locally)
How to Play Text114-85hidden
with Screen Anchor = Center
with Z-Index = 156
with Text / UI > Text = GUN LEVEL +1/MAX 4 (Edit Object Locally)
with Text / UI > Font Size = 21 (Edit Object Locally)
with Text / UI > Color = #C4D8E4 (Edit Object Locally)
with Text / UI > Alignment = Left (Edit Object Locally)
with Text / UI > Transform > Size X = 296 (Edit Object Locally)
How to Play Pickup-249-125hidden
with Sprite > Sprite = Spread Pickup Art (Edit Object Locally)
How to Play Text-133-125hidden
with Screen Anchor = Center
with Z-Index = 156
with Text / UI > Text = SPREAD SHOT (Edit Object Locally)
with Text / UI > Font Size = 24 (Edit Object Locally)
with Text / UI > Color = #8CFF66 (Edit Object Locally)
with Text / UI > Alignment = Left (Edit Object Locally)
with Text / UI > Transform > Size X = 166 (Edit Object Locally)
How to Play Text114-125hidden
with Screen Anchor = Center
with Z-Index = 156
with Text / UI > Text = WIDE FAN OF ROUNDS (Edit Object Locally)
with Text / UI > Font Size = 21 (Edit Object Locally)
with Text / UI > Color = #C4D8E4 (Edit Object Locally)
with Text / UI > Alignment = Left (Edit Object Locally)
with Text / UI > Transform > Size X = 296 (Edit Object Locally)
How to Play Pickup-249-165hidden
with Sprite > Sprite = Rapid Pickup Art (Edit Object Locally)
How to Play Text-133-165hidden
with Screen Anchor = Center
with Z-Index = 156
with Text / UI > Text = RAPID GUNS (Edit Object Locally)
with Text / UI > Font Size = 24 (Edit Object Locally)
with Text / UI > Color = #5AC8FF (Edit Object Locally)
with Text / UI > Alignment = Left (Edit Object Locally)
with Text / UI > Transform > Size X = 166 (Edit Object Locally)
How to Play Text114-165hidden
with Screen Anchor = Center
with Z-Index = 156
with Text / UI > Text = FAST GUNS FOR 10 SEC (Edit Object Locally)
with Text / UI > Font Size = 21 (Edit Object Locally)
with Text / UI > Color = #C4D8E4 (Edit Object Locally)
with Text / UI > Alignment = Left (Edit Object Locally)
with Text / UI > Transform > Size X = 296 (Edit Object Locally)
How to Play Pickup-249335hidden
with Screen Anchor = Bottom Center
with Sprite > Sprite = Bomb Pickup Art (Edit Object Locally)
How to Play Text-133335hidden
with Screen Anchor = Bottom Center
with Z-Index = 156
with Text / UI > Text = BOMB (Edit Object Locally)
with Text / UI > Font Size = 24 (Edit Object Locally)
with Text / UI > Color = #FF7B6B (Edit Object Locally)
with Text / UI > Alignment = Left (Edit Object Locally)
with Text / UI > Transform > Size X = 166 (Edit Object Locally)
How to Play Text114335hidden
with Screen Anchor = Bottom Center
with Z-Index = 156
with Text / UI > Text = +1 SCREEN-CLEARING BOMB (Edit Object Locally)
with Text / UI > Font Size = 21 (Edit Object Locally)
with Text / UI > Color = #C4D8E4 (Edit Object Locally)
with Text / UI > Alignment = Left (Edit Object Locally)
with Text / UI > Transform > Size X = 296 (Edit Object Locally)
How to Play Pickup-249295hidden
with Screen Anchor = Bottom Center
with Sprite > Sprite = Medkit Pickup Art (Edit Object Locally)
How to Play Text-133295hidden
with Screen Anchor = Bottom Center
with Z-Index = 156
with Text / UI > Text = MEDKIT (Edit Object Locally)
with Text / UI > Font Size = 24 (Edit Object Locally)
with Text / UI > Color = #FFFFFF (Edit Object Locally)
with Text / UI > Alignment = Left (Edit Object Locally)
with Text / UI > Transform > Size X = 166 (Edit Object Locally)
How to Play Text114295hidden
with Screen Anchor = Bottom Center
with Z-Index = 156
with Text / UI > Text = +1 LIFE/MAX 5 (Edit Object Locally)
with Text / UI > Font Size = 21 (Edit Object Locally)
with Text / UI > Color = #C4D8E4 (Edit Object Locally)
with Text / UI > Alignment = Left (Edit Object Locally)
with Text / UI > Transform > Size X = 296 (Edit Object Locally)
How to Play Strip0257hidden
with Screen Anchor = Bottom Center
with Z-Index = 153
with Sprite > Tint = #486677 (Edit Object Locally)
with Sprite > Transform > Size = X 544, Y 1 (Edit Object Locally)
How to Play Text-123228hidden
with Screen Anchor = Bottom Center
with Z-Index = 156
with Text / UI > Text = 4 WAVES (Edit Object Locally)
with Text / UI > Font Size = 26 (Edit Object Locally)
with Text / UI > Color = #FFE8A3 (Edit Object Locally)
with Text / UI > Transform > Size X = 170 (Edit Object Locally)
How to Play Key-12228hidden
with Screen Anchor = Bottom Center
with Z-Index = 153
with Sprite > Sprite = Key Arrow Icon (Edit Object Locally)
with Sprite > Transform > Size = X 24, Y 24 (Edit Object Locally)
How to Play Text107228hidden
with Screen Anchor = Bottom Center
with Z-Index = 156
with Text / UI > Text = SKY FORTRESS (Edit Object Locally)
with Text / UI > Font Size = 26 (Edit Object Locally)
with Text / UI > Color = #FFE8A3 (Edit Object Locally)
with Text / UI > Transform > Size X = 210 (Edit Object Locally)
How to Play Key-77169hidden
with Screen Anchor = Bottom Center
with Sprite > Sprite = Key Enter Icon (Edit Object Locally)
with Sprite > Transform > Size = X 72, Y 36 (Edit Object Locally)
How to Play Text-23169hidden
with Screen Anchor = Bottom Center
with Z-Index = 155
with Text / UI > Text = OR (Edit Object Locally)
with Text / UI > Font Size = 22 (Edit Object Locally)
with Text / UI > Color = #9FC3D8 (Edit Object Locally)
with Text / UI > Transform > Size X = 31 (Edit Object Locally)
How to Play Key21169hidden
with Screen Anchor = Bottom Center
with Sprite > Sprite = Key Esc Icon (Edit Object Locally)
with Sprite > Transform > Size = X 52, Y 36 (Edit Object Locally)
How to Play Text85169hidden
with Screen Anchor = Bottom Center
with Z-Index = 155
with Text / UI > Text = RETURN (Edit Object Locally)
with Text / UI > Font Size = 22 (Edit Object Locally)
with Text / UI > Color = #9FC3D8 (Edit Object Locally)
with Text / UI > Transform > Size X = 69 (Edit Object Locally)

10.4 Three Sets of Controls

First, the controls. Right now every Command works everywhere. Once there’s a Title and a Main Menu, one key has different jobs in different places. Space takes off on the Title and fires in a mission, and Esc goes back on the menu but pauses a fight.

So the Commands go into three Input Contexts. Title holds only Confirm. Menus holds Fly, Confirm and Back. Flight holds Fly, Fire, Bomb, Pause and Confirm. Only one is on at a time, and each Scene switches on its own.

10.4.1 The Input Contexts

Open the Game Settings, and choose Input Manager. On the left is the Input Contexts list. Your project has one, named Default, and every Command you’ve made is in it.

Rename it first. Press the pencil button on its row, and the Edit Input Context window opens. Type Title, and press Save Input Context. Its switch says Active at Start. That’s the card’s Active at Start: this set is on when the game begins.

Next, press Add Input Context, under the list. Type Flight, and press Add Input Context in the window. Flight is selected now, and its switch says Inactive at Start, as the card has it.

On the right is the selected context’s Command Set. Below it, the Reuse a Command… list holds the Commands you’ve already made. Pick Fly from it, then Fire, Bomb and Confirm. Each one joins Flight.

Here’s the catch. A Command brings its name along, but not its keys. Each Input Context keeps keys of its own. So each Command you reuse shows Shared across Input Contexts, and no keys at all.

Give them the same keys as before. The card’s INPUT CONTEXTS block lists each set’s Commands, but not their keys, so the keys are here in the words.

Press Add Keybinding under a Command, click the new row, and press the key. Fly has a key for each direction, so each of its rows has a list for its direction too. Its keys are the arrows and W, A, S and D, as in Chapter 1. Fire is Space and J, Bomb is B and K, and Confirm is Enter.

The card’s COMMANDS block has two new Commands. Press Add Command while Flight is selected, and make Pause, a Button, with Escape and P. A new Command joins the context that’s selected.

Now Menus. Add it the same way, and reuse Fly and Confirm. Fly gets the same keys again.

The menu only listens for Up and Down, but it’s the same Command, so it may as well have them all. Confirm gets Enter and Space. Then add Back, a new Button, with Escape and Backspace.

A right click is Back too. The card’s COMMANDS block lists only Back’s keys, but the click belongs to the game as well. Press Add Keybinding, click the new row, and then right-click it. The row reads the mouse button the same way it reads a key.

Last, Title. It comes last for a reason: a Command taken out of the only context that holds it is deleted from your project, with its keys. By now Flight holds Fly, Fire and Bomb, so they’re safe.

Select Title, and take out the Commands it no longer needs, with the red trash button at the right end of each Command’s row. Press it for Fly, Fire and Bomb. Only Confirm is left.

Give it Space too, and a left click. The click takes two. Press Add Keybinding, and click the new row: that click only starts it listening. Then click once more, and the row keeps it as Left.

Now a click anywhere on the Title takes off.

10.4.2 Use Flight Controls

When a Scene starts, only the context that’s Active at Start is on. That’s Title, in every Scene. So the mission has to switch on its own set.

Use Flight Controls does it, the moment Gameplay starts: it switches Flight on, and Title off.

Set Input Context Active has a list of your Input Contexts. It starts on Title, the one that’s Active at Start. Pick Flight in the first block, and leave its Active on Yes, as it starts. The second block stays on Title, so pick No in its Active list, as the card has it.

It needs no Variables. Attach it to Game Rules, below Mission Complete.

Logic ComponentUse Flight ControlsAttach to: Game Rules

When a mission starts, the Flight controls are on and the Title controls off.

Attach toAny Object
When the Scene Starts
WhenScene Start
1Set Input Context Active
Input Context
Flight
2Set Input Context Active
Input Context
Title
Active
No

Save, and run the game. Nothing looks any different from Chapter 9’s game, and that’s the point. The Fighter flies, Space fires, and B drops a bomb, as before. If it won’t fly at all, look in Flight: the keys you gave Fly may be missing.

10.5 The Title

Now the front door itself.

10.5.1 The Title Scene

Make a new Scene with Add > Scene, and name it Title. The card’s SCENE Title block gives its settings, the same as Gameplay’s. Its Main Camera sees the same piece of sea, and its Main View sits in the same window. Add the Pacific Ocean under Screen Backgrounds. Then give the Scene the card’s Background Color.

You set a Scene’s camera, view and background once before, in Chapter 1. If the clicks have faded, the Set up card in Making what a card shows has them.

The Title’s sea has the same scenery as Gameplay’s. Place each one from the card’s PLACE THESE for the Title, at the same X and Y it has in Gameplay, from Chapter 5. Only the High Cloud isn’t on the Title’s list.

Place the Screen Frame too, at 0 and 0, so the riveted wall frames the Title as it frames Gameplay.

10.5.2 Patrol

The Fighter on the Title doesn’t fly. It bobs, as if it were holding its place in the wind. That’s Patrol, the Sky Fortress’s slow sway from Chapter 9, at gentler speeds.

Patrol’s blocks need no change for it. Its Changes card adds the Title Plane to its top line, and gives it a new Description, which says what the Title needs too. It starts its sway from where it was when it appeared.

Logic ComponentPatrolAttach to: Sky Fortress, Title PlaneAddDelete

While on, drifts side to side and up and down in a slow wave around where it started patrolling (when it appeared, or when it was switched on).

Attach toAny Object
DATA STRUCTURES
Patrol Dataself.patrolData
SHARED VARIABLES
NameTypeKindStarting Value
sideSpeedNumberConstant3.75
sideRateNumberConstant0.55
bobSpeedNumberConstant0.563
bobRateNumberConstant1.1
Every Step
WhenStep
1Change Component Value
Component Value
self.patrolData.secondsPatrolled
Operator
+=
Value
$deltaTime
2Set Velocity
X Velocity
cos(@self.sideRate * self.patrolData.secondsPatrolled) * @self.sideSpeed
Y Velocity
sin(@self.bobRate * self.patrolData.secondsPatrolled) * @self.bobSpeed

10.5.3 Title Plane

The Title Plane is a picture of the Fighter. It has no Collider, so make it an Empty Object, and attach a Sprite with the Fighter Art, 3 meters by 3.

Attach Patrol, and it brings Patrol Data along by itself. Under Shared Variables, type its four numbers. Its sideSpeed is far below the one Patrol starts with, so the plane drifts only a little. Its two rates are a touch higher, so each sway comes round a little sooner. Then Cast Shadow, with the Fighter Shadow, so it casts its shadow on the clouds like the real one.

ObjectTitle Plane
Transform
Bounding Box > SizeX 3, Y 3
Sprite
Scene Depth Draw Order30
SpriteFighter Art
Transform > SizeX 3, Y 3
Data Structure
From LogicPatrol
Data StructurePatrol Data
Logic
Patrol
Cast Shadow
Shared Variables
shadowFighter Shadow
offsetX1.031
offsetY-1.875
sideSpeed0.569
sideRate0.7
bobSpeed0.5
bobRate1.6

Place it from PLACE THESE, near the bottom middle of the sea.

10.5.4 Title Logo and Title High Score

The Title Logo is the gold SKY ACE on its red banner, the Title Logo Art at 640 by 300 pixels. It sits on the screen, at Top Center.

The Title High Score is a Text / UI at Bottom Center. Its words are HIGH SCORE, two spaces, then {$highScore}, so it shows the number High Score reads. Leave its Color as a new Text starts, white.

ObjectTitle Logo
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorTop Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order110
SpriteTitle Logo Art
Transform > SizeX 640, Y 300
ObjectTitle High Score
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorBottom Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 48
Text / UI
TextHIGH SCORE {$highScore}
FontBebas Neue
Font Size26
Letter Spacing1
AlignmentCenter
Text BoundsWrap to Width
Transform > Size X600

10.5.5 The Take-Off Prompt

PRESS ENTER TO TAKE OFF is three pieces in a row, at Bottom Center: the word PRESS, a picture of the Enter key, and the words TO TAKE OFF. All three blink together.

Take Off Press is a Text / UI in Bebas Neue, a pale gold. Take Off Words is its twin: Duplicate it, name the copy Take Off Words, and change its Text and its Size X. Take Off Key is the Key Enter Icon, 92 by 46 pixels.

Each one has Blink, from Chapter 9, switched on this time. Leave its numbers as they start. The Warning Banner blinked faster, with numbers of its own, but the prompt keeps Blink’s: a slow, steady blink.

ObjectTake Off Press
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorBottom Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 48
Text / UI
TextPRESS
FontBebas Neue
Font Size40
Color#FFE8A3
Letter Spacing1
AlignmentCenter
Text BoundsWrap to Width
Transform > Size X92
Logic
Blink
ObjectTake Off Words
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorBottom Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 48
Text / UI
TextTO TAKE OFF
FontBebas Neue
Font Size40
Color#FFE8A3
Letter Spacing1
AlignmentCenter
Text BoundsWrap to Width
Transform > Size X171
Logic
Blink
ObjectTake Off Key
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorBottom Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order120
SpriteKey Enter Icon
Transform > SizeX 92, Y 46
Logic
Blink

Place the three from PLACE THESE, with their Z-Indexes, and place the logo and the high score too.

10.5.6 Title Music

The Title Theme starts the moment the game does. Title Music has one Event, When the Game Starts, a Game Start Event in the Add Event window. It runs once, when the whole game begins, and never again.

That matters. The Title and the Main Menu share the Title Theme, and going between them shouldn’t start it over. A Scene Start Event would. Game Start doesn’t.

Logic ComponentTitle MusicAttach to: Title Controls

Loops the Title Theme from the moment the game starts.

Attach toAny Object
When the Game Starts
WhenGame Start
1Control Sound
Operation
Loop
Sound
"Title Theme"

10.5.7 Title Controls

Title Controls is the Title’s Game Rules: an Empty Object with no picture, placed at 0 and 0. Attach Title Music.

Then attach High Score, from Chapter 4, as it is. When the Title opens, it reads the high score from this device, as it does when a mission starts. Its changes come in the part called Pause. Take Off comes in the next part, so leave its line on the card for now.

ObjectTitle Controls
Transform
Bounding Box > SizeX 3, Y 3
Logic
Take Off
Title Music
High Score

Place Title Controls from PLACE THESE.

10.5.8 Start Scene

The game should open on the Title now. In the Game Settings, under General, pick Title · 2D in Start Scene. That’s the card’s GAME SETTINGS line.

Save, and run the game. The sea slides by under the clouds, as it does in a mission. The SKY ACE banner shines at the top, and your Fighter bobs under it, side to side. Its shadow falls on the clouds as they pass. HIGH SCORE shows your best.

PRESS ENTER TO TAKE OFF blinks at the bottom. The Title Theme plays.

Press Enter, and nothing happens yet, because there’s nowhere to go. That’s the next part.

For now, there’s no way into a mission either. If you’d like to fly one while you build, pick Gameplay · 2D in Start Scene for a while, and pick Title again after.

10.6 The Main Menu

Now the menu, and the way into a mission.

10.6.1 The Main Menu Scene

Make one more Scene, named Main Menu, from the card’s SCENE Main Menu block, as you made the Title. Place the same scenery, and this time the High Cloud too, then the Screen Frame.

10.6.2 Go to the Main Menu and Take Off

Go to the Main Menu is the Title’s way out: it plays Menu Select, and Go to Scene fades to the Main Menu.

Make its one Parameter first, fadeSeconds, a Number at 0.35, in a section named Effects. Go to Scene has a Scene list, so pick Main Menu. Its Transition starts on Cut, which switches at once, so pick Fade, which goes to black and back. Type fadeSeconds over its Transition Seconds.

FunctionGo to the Main Menu

Plays Menu Select and fades to the Main Menu.

PARAMETERS
NameTypeStarts at
SectionEffects
fadeSecondsNumber0.35
ACTIONS
1Control Sound
Sound
"Menu Select"
2Go to Scene
Scene
Main Menu
Transition
Fade
Transition Seconds
fadeSeconds

Take Off calls it when Confirm is pressed. The call’s Fade Seconds box can stay as it starts, with the Function’s own 0.35.

Logic ComponentTake OffAttach to: Title Controls

On the Title, Confirm (Enter, Space, or a left click anywhere) goes to the Main Menu.

Attach toAny Object
When Confirm Is Pressed
WhenCommand PressedCommand: Confirm
1Go to the Main MenuFunction

Attach Take Off to Title Controls. It lands below the other two, not where the card has it. That’s fine here. None of them needs another to go first.

10.6.3 The Menu’s Jobs

Each of the three buttons does one job, and each job is a Function with no Parameters. Make all four of this part’s Functions now. A fifth calls them. Then Menu Choice can call it, and Main Menu Keys can find the messages they send.

Three of the jobs start with the same click, Menu Select. Then Start the Mission fades to Gameplay, a little slower than the menus’ own fades. Mission Start does the rest, as it does for every mission.

Open How to Play only sends word that the panel is open. Nothing shows the panel yet. That’s the next part. Close How to Play is its way back, with the softer Menu Move.

Quit the Game ends the game, with End Game. That block has no fields at all.

FunctionStart the Mission

Plays Menu Select and fades to Gameplay, where Mission Start sets up a fresh mission.

ACTIONS
1Control Sound
Sound
"Menu Select"
2Go to Scene
Scene
Gameplay
Transition
Fade
Transition Seconds
0.5
FunctionOpen How to Play

Plays Menu Select and opens the How to Play panel (howToPlayOpened).

ACTIONS
1Control Sound
Sound
"Menu Select"
2Trigger Custom Event
Custom Event
howToPlayOpened
FunctionQuit the Game

Plays Menu Select and ends the game.

ACTIONS
1Control Sound
Sound
"Menu Select"
2End Game
FunctionClose How to Play

Plays Menu Move and closes the How to Play panel (howToPlayClosed).

ACTIONS
1Control Sound
Sound
"Menu Move"
2Trigger Custom Event
Custom Event
howToPlayClosed

The fifth, Do What Was Chosen, is how a button does its job. It asks about $menuChoice three times, one If after another. The If that matches calls its job. Each If joins the main line with Connect to sequence, under the one before it. Its own Add inside Then adds its call.

FunctionDo What Was Chosen

Does the job of the chosen Main Menu button ($menuChoice): START MISSION, HOW TO PLAY or QUIT GAME.

ACTIONS
1If$menuChoice == 0
Then
2Start the MissionFunction
3If$menuChoice == 1
Then
4Open How to PlayFunction
5If$menuChoice == 2
Then
6Quit the GameFunction

10.6.5 Use Menu Controls

Use Menu Controls is the menu’s Use Flight Controls. When the Main Menu starts, it switches Menus on, and Title off.

Logic ComponentUse Menu ControlsAttach to: Menu Controls

When the Main Menu starts, its Menus controls are on and the Title controls off.

Attach toAny Object
When the Scene Starts
WhenScene Start
1Set Input Context Active
Input Context
Menus
2Set Input Context Active
Input Context
Title
Active
No

10.6.7 Show If Chosen and Lit When Chosen

Each button has a lit twin over it, a red button, shown only while its choice is the chosen one.

Show If Chosen decides. If $menuChoice equals the caller’s choice, Set Visible shows the caller. Else, it hides it. Its PARAMETERS are Caller, the Object at the very end of Add Parameter’s Type list, and choice, a Number. Both Set Visibles apply to Caller. Visible is a list that starts on No, so pick Yes in the first, the card’s true, and leave the second.

FunctionShow If Chosen

Shows the caller while its choice is the chosen Main Menu button, and hides it otherwise.

PARAMETERS
NameTypeStarts at
CallerObject
choiceNumber0
ACTIONS
1If$menuChoice == choice
Then
2Set Visible
Applies To
Caller
Visible
true
3Otherwise
4Set Visible
Applies To
Caller
Visible
false

Lit When Chosen calls it at two moments: When Created, as the menu opens, and when $menuChoice changes. That second one is a Variable Changed Event. It asks which Global Variable, so pick menuChoice. Myth runs it by itself, at the end of the frame in which the choice changed.

Its heading on the card is On Variable Changed · Menu Choice. The end is the Global’s name, menuChoice, the way Myth writes it in words. It isn’t the Menu Choice Logic Component.

Its one PER INSTANCE VARIABLE is choice, a Number at 0, and each placement gives its own. In each call, caller starts on self, so leave it, and type self.choice in the choice box.

Logic ComponentLit When ChosenAttach to: Menu Button Lit

Shows this lit button while its choice is the chosen one.

Attach toAny Object
PER INSTANCE VARIABLES
NameTypeStarting Value
choiceNumber0
When Created
WhenCreate
1Show If ChosenFunction
caller
self
choice
self.choice
On Variable Changed · Menu Choice
WhenVariable ChangedGlobal Variable: menuChoice
1Show If ChosenFunction
caller
self
choice
self.choice

Notice what isn’t here. No piece of Logic checks the choice every frame. The lit button waits until the choice changes, then looks once.

10.6.10 The Rest of the Menu

The Menu Logo is the Title Logo, smaller, so Duplicate the Title Logo, and type the copy’s name and its size, 416 by 195. The Menu High Score is a copy of the Title High Score. It’s gold, and a little bigger.

The prompt at the bottom is five pieces: the Up and Down keys and CHOOSE, then the Enter key and CONFIRM. Choose Key Up is the Key Up Icon, 32 by 32. Choose Key Down is its twin with the Key Down Icon. Confirm Key is a third copy, with the Key Enter Icon at 64 by 32. The two words, Choose Words and Confirm Words, are twins as well, pale blue, like the result screen’s FLY AGAIN.

ObjectMenu Logo
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorTop Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order110
SpriteTitle Logo Art
Transform > SizeX 416, Y 195
ObjectMenu High Score
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorBottom Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 48
Text / UI
TextHIGH SCORE {$highScore}
FontBebas Neue
Font Size30
Color#FFE8A3
Letter Spacing1
AlignmentCenter
Text BoundsWrap to Width
Transform > Size X600
ObjectChoose Key Up
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorBottom Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order120
SpriteKey Up Icon
Transform > SizeX 32, Y 32
ObjectChoose Key Down
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorBottom Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order120
SpriteKey Down Icon
Transform > SizeX 32, Y 32
ObjectChoose Words
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorBottom Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 48
Text / UI
TextCHOOSE
FontBebas Neue
Font Size24
Color#BCD7E8
Letter Spacing1
AlignmentCenter
Text BoundsWrap to Width
Transform > Size X74
ObjectConfirm Key
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorBottom Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order120
SpriteKey Enter Icon
Transform > SizeX 64, Y 32
ObjectConfirm Words
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorBottom Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 48
Text / UI
TextCONFIRM
FontBebas Neue
Font Size24
Color#BCD7E8
Letter Spacing1
AlignmentCenter
Text BoundsWrap to Width
Transform > Size X83

10.6.11 Placing the Menu

Now place the Main Menu’s pieces from PLACE THESE. The buttons go in three rows, each a set of three: Menu Button, Menu Button Lit, and Menu Button Label.

Select each Menu Button you place. In Menu Choice’s section of its Logic, under Per Instance Variables, type its Choice. The first keeps 0, where choice starts, so its row has no line under it. Each Menu Button Lit gets the same Choice as the button under it, in Lit When Chosen’s section, and starts hidden.

The second and third labels say other words. Their lines end in (Edit Object Locally), so select each one, press Edit Object Locally, choose its Text / UI, and type HOW TO PLAY, or QUIT GAME. Back to Scene takes you back. The placement keeps its own words, and the Object stays START MISSION, as Edit Object Locally in Making what a card shows explains.

10.6.12 Mission Music

One more change, for the trip into a mission. The Title Theme keeps playing until something stops it, so when Gameplay starts, Mission Music stops it first.

Its new Control Sound goes first in When the Scene Starts. Add it from the Action List. Then drag it onto the arrow between the Event’s Mode block and the first Control Sound. That’s how you put Make a Row Arrive’s If first in Chapter 8. Pick Stop in its Operation, and Title Theme in its Sound.

Logic ComponentMission MusicAttach to: Game RulesAddDelete

Stops the Title Theme; plays the Battle Theme and the engine drone during the mission, the Boss Theme for the Sky Fortress, and the Game Over Jingle or the Victory Jingle at the end.

Attach toAny Object
When the Scene Starts
WhenScene Start
1Control Sound
Operation
Stop
Sound
"Title Theme"
2Control Sound
Operation
Loop
Sound
"Battle Theme"
3Control Sound
Operation
Loop
Sound
"Engine Drone"
On Game State Changed
WhenGame State Changed
1Check Game State
Action Name
missionFailed
Game State
Mission Failed
2Check Game State
Action Name
missionComplete
Game State
Mission Complete
3IfmissionFailed.value == true || missionComplete.value == true
Then
4Control Sound
Operation
Stop
Sound
"Battle Theme"
5Control Sound
Operation
Stop
Sound
"Boss Theme"
6Control Sound
Operation
Stop
Sound
"Engine Drone"
7IfmissionFailed.value == true
Then
8Control Sound
Sound
"Game Over Jingle"
9Otherwise
10Control Sound
Sound
"Victory Jingle"
On Fortress Warning
WhenfortressWarningCustom Event
1Control Sound
Operation
Stop
Sound
"Battle Theme"
2Control Sound
Operation
Loop
Sound
"Boss Theme"

Save, and run the game. Press Enter on the Title. The screen fades, and the Main Menu opens, with START MISSION lit red. The Title Theme plays on, not from the start.

Press Down, and HOW TO PLAY lights, with a click of Menu Move; press it twice more, and START MISSION lights again. Move the mouse over QUIT GAME, and it lights. Press Esc, and you’re back on the Title, where the prompt still blinks.

Choose START MISSION. The screen fades into the mission, the Title Theme stops, and the Battle Theme starts. Your controls are the flying ones again.

HOW TO PLAY seems to do nothing yet, but the keys stop answering, because as far as the game knows, the panel is open. Press Enter or Esc to close it, and the keys come back. And QUIT GAME ends the game.

That’s the menu. It’s a good place to stop for a break, if you’d like one.

10.7 How to Play

Now the panel that HOW TO PLAY opens. It’s a dark sheet over the menu, titled HOW TO PLAY, with PILOT QUICK GUIDE under it. It shows the keys for MOVE, FIRE, BOMB and PAUSE, the five pickups and what each one gives, the way the mission goes, and how to close it.

10.7.1 Show With How to Play

Every piece of the panel has Show With How to Play, which shows its piece when howToPlayOpened comes and hides it when howToPlayClosed comes. It has no Variables. Each Set Visible’s Visible is a list that starts on No, so pick Yes in the first, and leave the second.

Logic ComponentShow With How to PlayAttach to: How to Play Veil, How to Play Panel, How to Play Text, How to Play Strip, How to Play Key, How to Play Pickup

Shows this How to Play piece while the panel is open.

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

10.7.2 Six Objects

The panel looks like dozens of pieces, but it’s six Objects, each placed many times. Every placement gets its own words, picture, size or color with Edit Object Locally.

The How to Play Veil is the White Pixel, stretched over the whole window, and tinted almost black on its placement. The How to Play Panel is the Large Panel Art. The How to Play Strip is the White Pixel again, a dark band for each row of keys.

The How to Play Text is words, HOW TO PLAY in gold. The How to Play Key is a key’s picture, and the How to Play Pickup a pickup’s. Each starts with one picture, and each placement picks its own.

All six are on the screen, and each has Show With How to Play.

ObjectHow to Play Veil
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order150
SpriteWhite Pixel
Transform > SizeX 720, Y 960
Tint (on its placement)#04101C
Logic
Show With How to Play
ObjectHow to Play Panel
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order151
SpriteLarge Panel Art
Transform > SizeX 640, Y 840
Logic
Show With How to Play
ObjectHow to Play Strip
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorTop Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order152
SpriteWhite Pixel
Transform > SizeX 568, Y 82
Tint (on its placement)#142C3D
Logic
Show With How to Play
ObjectHow to Play Text
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorTop Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 48
Text / UI
TextHOW TO PLAY
FontBebas Neue
Font Size44
Color#F4C542
Letter Spacing1
AlignmentCenter
Text BoundsWrap to Width
Transform > Size X560
Logic
Show With How to Play
ObjectHow to Play Key
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorTop Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order155
SpriteKey Up Icon
Transform > SizeX 34, Y 34
Logic
Show With How to Play
ObjectHow to Play Pickup
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorCenter
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order153
SpritePower Pickup Art
Transform > SizeX 42, Y 42
Logic
Show With How to Play

10.7.3 Placing the Panel

This is the longest list of placements in the book. It’s long, but there’s nothing new in it after the first few. Every placement is hidden, so turn off Visible at Game Start on each one.

It helps to see its pattern. The veil and the panel come first, then the titles. Then each row of keys: a strip, a word on the left, and key pictures, with OR between two sets. After the keys come PICKUPS and five rows, each a pickup’s picture, its name in its own color, and what it gives. Last, a thin line, 4 WAVES and SKY FORTRESS, and the way back.

Some placements pick their Screen Anchor, Center or Bottom Center, so pick it first, then type the Screen Offset.

Then each one’s (Edit Object Locally) lines. A word’s Text, Font Size, Color and Size X are all in its Text / UI. A key’s or a pickup’s picture and size are in its Sprite.

The veil and the strips need one more thing, and the rows of PLACE THESE don’t show it: their Tint. It’s on their Object cards, Tint (on its placement). It goes on the veil’s placement and on each strip’s, the way the Result Veil got its own in Chapter 4. The one strip that’s a thin line is the exception. Its own lighter Tint comes in its (Edit Object Locally) lines instead.

Myth can save you some of the typing. Right-click a placement in the Scene and choose Duplicate, or press Ctrl+D.

The copy has everything the first one had: hidden, its anchor, its Z-Index, its Tint and its (Edit Object Locally) values. Type its Screen Offset. Then change only what differs. A strip copied from a strip has its Tint already.

If your rows don’t line up, the catch-up download in the Goal has the panel finished, to compare. And a break halfway through is fine too.

Save, and run the game. Choose HOW TO PLAY. The dark sheet covers the menu, with every key, every pickup and the way the mission goes. Up and Down do nothing, and the mouse doesn’t light the buttons under it. Press Esc, or Enter, and it’s gone, with a click.

10.8 Pause

Now a way to stop for a moment, in the middle of a fight.

10.8.1 Back to the Main Menu

Back to the Main Menu is how a mission ends early. It plays Menu Select, stops the three mission sounds, starts the Title Theme again, and fades to the Main Menu.

Three things will call it: QUIT TO MAIN MENU on the PAUSED menu, MAIN MENU after a loss, and RETURN TO BASE after a win.

FunctionBack to the Main Menu

Plays Menu Select, stops the mission's music and engine drone, starts the Title Theme and fades to the Main Menu.

PARAMETERS
NameTypeStarts at
SectionEffects
fadeSecondsNumber0.35
ACTIONS
1Control Sound
Sound
"Menu Select"
2Control Sound
Operation
Stop
Sound
"Battle Theme"
3Control Sound
Operation
Stop
Sound
"Boss Theme"
4Control Sound
Operation
Stop
Sound
"Engine Drone"
5Control Sound
Operation
Loop
Sound
"Title Theme"
6Go to Scene
Scene
Main Menu
Transition
Fade
Transition Seconds
fadeSeconds

10.8.2 Keep a Better Score and High Score

High Score keeps a better score when the mission ends. Now it needs to do that from two places, so its If moves into a Function of its own, Keep a Better Score.

The Function holds what was High Score’s inner If: when $score beats $highScore, it takes the score and saves it. Its Save Persistent Value’s Action Name is highScoreSaved now, so type that over the one it starts with.

FunctionKeep a Better Score

Saves the score as the high score on this device when it beats the high score.

ACTIONS
1If$score > $highScore
Then
2Change Variable
Variable
$highScore
Value
$score
3Save Persistent Value
Action Name
highScoreSaved
Key
"highScore"
Value
$highScore

On High Score’s Changes card, the inner If is struck, with both its blocks. Click it and delete it, and the two go with it. Then add a call to Keep a Better Score with the outer If’s Add inside Then.

The second place is a new Event, On Mission Quit. Nothing sends missionQuit yet, so add it with Add Custom Event…. It calls Keep a Better Score too. A mission quit from the PAUSED menu never reaches a Game State, so this is how its score gets kept.

The card’s top line names three Objects now. You attached High Score to Title Controls and Menu Controls already. Type its new Description too.

Logic ComponentHigh ScoreAttach to: Game Rules, Title Controls, Menu ControlsAddDelete

Reads the high score from this device when a Scene starts, and saves a better score when the mission ends.

Attach toAny Object
When the Scene Starts
WhenScene Start
1Load Persistent Value
Action Name
savedHighScore
Key
"highScore"
Default
0
2Change Variable
Variable
$highScore
Value
savedHighScore.value
On Game State Changed
WhenGame State Changed
1Check Game State
Action Name
missionFailed
Game State
Mission Failed
2Check Game State
Action Name
missionComplete
Game State
Mission Complete
3IfmissionFailed.value == true || missionComplete.value == true
Then
4If$score > $highScore
Then
5Change Variable
Variable
$highScore
Value
$score
6Save Persistent Value
Action Name
persistentWriteResult
Key
"highScore"
Value
$highScore
4Keep a Better ScoreFunction
On Mission Quit
WhenmissionQuitCustom Event
1Keep a Better ScoreFunction

10.8.3 Pause Overlay Lifecycle

The PAUSED menu itself comes with Myth Engine. Pause Overlay Lifecycle pauses the whole game and shows a menu over it, and hides it again.

Make it with Add > Logic Component, and pick it in the Starter list, under UI, as you made Top-down Controls in Chapter 1. Its Events come built, so its card is short. Its Description comes with it, in Myth’s own words. In plain ones, it pauses the game and shows a menu over it.

Logic ComponentPause Overlay LifecycleAttach to: Game Rules

Composes global simulation pause with the independent viewport-fixed pause-overlay transport.

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
pauseMenuSpecTextConstant{"title":"Paused","items":[{"id":"resumePauseOverlay","label":"Resume"}]}
Built in: this Logic Component comes whole from the engine's template.
You add it and set its Variables on the Object; you do not build its Events.

Its one Shared Variable is a Text, pauseMenuSpec. It describes the menu. Its Starting Value is Myth’s own small menu, Paused with one line, Resume. That one is there already, so there’s nothing to type here.

Sky Ace’s menu says PAUSED, with two lines: RESUME MISSION sends resumePauseOverlay, and QUIT TO MAIN MENU sends quitMission. Esc in the menu sends resumePauseOverlay too.

That longer value belongs to Game Rules. Attach Pause Overlay Lifecycle to Game Rules, and pauseMenuSpec joins its Shared Variables, with a Value box of its own.

The value to type is on the Game Rules card, at the end of this chapter. Look under Shared Variables, on its pauseMenuSpec line.

A Text’s Value box keeps what you type as it is, braces and double quotes too. So click it, delete Myth’s small menu, and type the card’s line exactly, with no spaces of your own. The card’s line may wrap on your screen, but in your box it’s one line. RESUME MISSION and QUIT TO MAIN MENU keep their single spaces.

10.8.4 Pause

Pause opens the menu, and answers it.

When Pause is pressed, it asks Check Game State whether the mission is still being played. On the result screens, Esc means MAIN MENU or RETURN TO BASE, not a pause. If it’s Playing, it clicks Menu Move and sends showPauseOverlay, and Pause Overlay Lifecycle hears that and pauses the game.

When resumePauseOverlay comes, it plays Menu Select. The overlay hides itself and goes on with the game.

When quitMission comes, Pause cleans up. It sends hidePauseOverlay, and Set Game Paused takes 0, to go on. Its box starts at 1, which pauses. Then missionQuit, so High Score keeps a better score, and Back to the Main Menu.

resumePauseOverlay may be in Add Event’s list already, since the overlay listens for it. If it isn’t, add it with Add Custom Event…, and quitMission the same way.

Logic ComponentPauseAttach to: Game Rules

During the mission, Pause (Esc, P) opens the PAUSED menu: RESUME MISSION continues, QUIT TO MAIN MENU keeps a better score and goes back to the Main Menu.

Attach toAny Object
When Pause Is Pressed
WhenCommand PressedCommand: Pause
1Check Game State
Action Name
stillPlaying
Game State
Playing
2IfstillPlaying.value == true
Then
3Control Sound
Sound
"Menu Move"
4Trigger Custom Event
Custom Event
showPauseOverlay
On Resume Pause Overlay
WhenresumePauseOverlayCustom Event
1Control Sound
Sound
"Menu Select"
On Quit Mission
WhenquitMissionCustom Event
1Trigger Custom Event
Custom Event
hidePauseOverlay
2Set Game Paused
Paused (1 pause / 0 resume)
0
3Trigger Custom Event
Custom Event
missionQuit
4Back to the Main MenuFunction

Attach Pause to Game Rules, after Pause Overlay Lifecycle.

Save, and run the game. Take off, start a mission, and press Esc. Everything stops. The PAUSED menu shows RESUME MISSION and QUIT TO MAIN MENU. Choose RESUME MISSION, or press Esc again, and the fight goes on from where it was.

Pause once more, and choose QUIT TO MAIN MENU. The Battle Theme stops, the Title Theme starts, and the Main Menu opens. If your score was a new best, it’s waiting there.

10.9 The Way Home

Last, the end of a mission. GAME OVER needs MAIN MENU beside FLY AGAIN, and the won mission’s RETURN TO BASE needs to go somewhere. That’s the promise Chapter 9 left you.

10.9.1 Fly Again

Fly Again gets a third Event. On the Game Over screen, Esc goes to the Main Menu: its Command is Pause, and it calls Back to the Main Menu. The call’s Fade Seconds box can stay as it starts. Type its new Description too.

Logic ComponentFly AgainAttach to: Game RulesAddDelete

On the Game Over screen, Confirm (Enter) or Fire starts a new mission and Pause (Esc) goes to the Main Menu. It is off until the result screen shows (Mission Over turns it on).

Attach toAny Object
When Confirm Is Pressed
WhenCommand PressedCommand: Confirm
1Start a New MissionFunction
caller
self
When Fire Is Pressed
WhenCommand PressedCommand: Fire
1Start a New MissionFunction
caller
self
When Pause Is Pressed
WhenCommand PressedCommand: Pause
1Back to the Main MenuFunction

10.9.3 Return to Base

Return to Base is Fly Again’s twin for a won mission: Confirm, Fire or Pause, any of them, calls Back to the Main Menu.

It’s attached to Game Rules switched off, so click its switch gray. The next piece turns it on.

Logic ComponentReturn to BaseAttach to: Game Rules

On the Mission Complete screen, Confirm (Enter), Fire or Pause goes back to the Main Menu. It is off until the result screen shows (Mission Over turns it on).

Attach toAny Object
When Confirm Is Pressed
WhenCommand PressedCommand: Confirm
1Back to the Main MenuFunction
When Fire Is Pressed
WhenCommand PressedCommand: Fire
1Back to the Main MenuFunction
When Pause Is Pressed
WhenCommand PressedCommand: Pause
1Back to the Main MenuFunction

10.9.4 Mission Over

Mission Over switches on Fly Again after a loss, and now, after a win, it switches on Return to Base.

In On the Result Screen Timer, its If gets an Else. Right-click the If and choose Add Else, and then Add inside Else adds Set Logic State. Pick Return to Base in its Logic Component list. Its Description changes too.

Logic ComponentMission OverAttach to: Game RulesAddDelete

When the mission ends, the result screen shows a moment later (resultSeconds after a loss, victorySeconds after a win); then FLY AGAIN and MAIN MENU after a loss, or RETURN TO BASE after a win, are switched on.

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
resultSecondsNumberConstant2.4
victorySecondsNumberConstant3
On Game State Changed
WhenGame State Changed
1Check Game State
Action Name
missionFailed
Game State
Mission Failed
2Check Game State
Action Name
missionComplete
Game State
Mission Complete
3IfmissionFailed.value == true || missionComplete.value == true
Then
4IfmissionFailed.value == true
Then
5Start Recurring Timer
Timer Name
resultScreen
First Delay (s)
@self.resultSeconds
Ring Once
Yes
6Otherwise
7Start Recurring Timer
Timer Name
resultScreen
First Delay (s)
@self.victorySeconds
Ring Once
Yes
On the Result Screen Timer
WhenRecurring TimerTimer name: resultScreen
1Trigger Custom Event
Custom Event
showResults
2Check Game State
Action Name
endedInFailure
Game State
Mission Failed
3IfendedInFailure.value == true
Then
4Set Logic State
Logic Component
"Fly Again"
5Otherwise
6Set Logic State
Logic Component
"Return to Base"

10.9.5 Game Rules

Here’s Game Rules now, with its four new rows at the bottom. Its pauseMenuSpec line, under Shared Variables, is the one you typed in the part called Pause. You attached Use Flight Controls, Pause Overlay Lifecycle and Pause before Return to Base, so yours sits last, not between them. That’s fine here. None of them needs another to go first.

ObjectGame RulesAddDelete
Transform
Bounding Box > SizeX 3, Y 3
Data Structure
From LogicRun Mission Timeline
Data StructureRun Mission Timeline Data
Logic
Add Points
Run Mission Timeline
Lose a Medkit
Lose a Gun Level
Mission Start
Mission Clock
High Score
Mission Music
Mission Over
Fly Again(turned off)
Run Waves
Pickup Rewards
Spend a Bomb
Mission Complete
Use Flight Controls
Return to Base(turned off)
Pause Overlay Lifecycle
Pause
Shared Variables
pauseMenuSpec{"title":"PAUSED","escape":"resumePauseOverlay","items":[{"id":"resumePauseOverlay","label":"RESUME MISSION"},{"id":"quitMission","label":"QUIT TO MAIN MENU"}]}

Save, and run the game. Lose a mission on purpose, as quickly as you like. GAME OVER shows FLY AGAIN and MAIN MENU side by side, each with its key. Press Esc, and you’re on the Main Menu.

10.10 The Whole Game

Now fly the whole game, from the front door to the Sky Fortress and home again.

Save, and run the game. Take off, start the mission, and fly all four waves. Bring down the Sky Fortress, and press Enter at MISSION COMPLETE.

Play it!

Watch for each of these.

  • The game opens on the Title: the sea, the SKY ACE banner, the Fighter bobbing side to side, HIGH SCORE, and PRESS ENTER TO TAKE OFF blinking. The Title Theme plays.
  • Enter, Space or a left click fades to the Main Menu, with a click of Menu Select. The Title Theme plays on.
  • START MISSION is lit red. Up and Down move the light, and it wraps around. The mouse lights a button too.
  • HOW TO PLAY covers the menu with the dark sheet. While it’s open, Up, Down and the mouse do nothing. Enter or Esc closes it.
  • Esc on the Main Menu goes back to the Title.
  • START MISSION fades into the mission in half a second, a little slower than the menus’ fade. The Title Theme stops, and the Battle Theme starts.
  • In the mission, Space only fires, and Enter does nothing at all. Esc opens PAUSED. Everything stops, the mission clock too, and RESUME MISSION goes on from where it was.
  • QUIT TO MAIN MENU goes back to the menu. It keeps your score if it’s a new best.
  • GAME OVER shows FLY AGAIN and MAIN MENU: Enter flies again, and Esc goes to the menu.
  • MISSION COMPLETE shows RETURN TO BASE. Enter, Space or Esc takes you to the Main Menu, and the Title Theme comes back.
  • After a mission, go back to the Title, where HIGH SCORE shows your best.
  • QUIT GAME ends the game.
How it works

Sky Ace has three Scenes now. The Title and the Main Menu share the sea, and the mission has the fight. Go to Scene moves between them. Each Scene switches on its own Input Context, so one key can take off, choose or fire.

On the Main Menu, one number is the choice, and every piece watches it. The keys and the mouse change it. The lit buttons follow it. Enter asks the chosen button to do its job, and Do What Was Chosen does the one that matches its choice.

Underneath is one idea you’ve used all along: a piece of Logic that knows only its own small job. Menu Choice doesn’t know what starting a mission means. It knows its own choice. It hands the job on. That’s why three placements of one Object can do three different things.

10.11 If It Didn’t Work

Something may be a little off the first time. That’s normal. This chapter has more settings than any other, so run the game, find the screen that misbehaves, and watch what it does.

The Fighter won’t fly in the mission, or won’t fire? Look at Flight in the Input Manager, where each reused Command needs its keys. Then look at Use Flight Controls on Game Rules: Flight on, Title off.

The Title’s keys still work on the menu? Use Menu Controls should switch Title off, with No in its Active.

The game still opens in a mission? Start Scene, under General in the Game Settings, should say Title · 2D.

The Title is there, but Enter does nothing? Take Off should be on Title Controls, and Title Controls placed on the Title. Confirm needs Enter in the Title context.

A Command is gone from the Input Manager altogether? It was taken out of the last context that held it. Make it again with Add Command, reuse it where the card lists it, and give it its keys. Its Logic finds it by name.

The menu opens, but no button is lit? Look at Lit When Chosen’s two Events: in each call, caller should say self, and choice should say self.choice. Each Menu Button Lit placement needs its choice, the same as its button’s.

Two buttons are lit at once? One Menu Button Lit placement has the wrong choice in its Logic row.

Enter on the menu does nothing? Main Menu Keys sends menuConfirmed, and Menu Choice listens for it. Then look at Do What Was Chosen. Its three Ifs ask about $menuChoice, with 0, 1 and 2, and each calls its job.

The wrong button’s job runs? A Menu Button placement’s choice doesn’t match its row. START MISSION is 0, HOW TO PLAY 1, and QUIT GAME 2.

The mouse does nothing? The Menu Button needs its Collider, as a Sensor.

After HOW TO PLAY, the keys never come back? Close How to Play should send howToPlayClosed, and Main Menu Keys’ On How to Play Closed should turn all four Events back to Choosing.

The panel shows only some pieces, or shows from the start? Each placement needs Show With How to Play on its Object, and Visible at Game Start off.

Two Title Themes play over each other, or it starts over on the menu? Title Music’s Event should be Game Start, not Scene Start.

The Title Theme goes on into the mission? The first step of Mission Music’s When the Scene Starts should stop it.

Esc does nothing in a mission? Pause belongs in Flight, with Escape and P. Then look at Pause on Game Rules, and Pause Overlay Lifecycle before it.

The PAUSED menu is empty, or Myth says something is wrong with pauseMenuSpec? Look at it under Game Rules’ Shared Variables. Hold it beside the card’s line. It starts with a brace, and every name keeps its double quotes.

QUIT TO MAIN MENU leaves the game frozen? Pause’s On Quit Mission needs Set Game Paused with 0.

RETURN TO BASE does nothing? Return to Base should be on Game Rules, switched off, and Mission Over’s new Else should switch it on.

Each of these is one small fix. Make it, run the game again, and you’re back with the chapter. And to compare, the catch-up download in the Goal is this chapter’s game, finished.

Challenge

One thing first. Save a copy to try things in. Choose File > Save as… and give the copy a new name. Myth goes on in the copy, and your game stays as it is.

The menu has room for a fourth button. Place a fourth Menu Button, Lit and Label, give them Choice 3, and type 4 in Main Menu Keys’ buttonCount. What would it do? Give Do What Was Chosen a fourth If, for 3, and a Function of your own to call.

Or make your own game. You’ve built a fighter, its guns, four waves of enemies, a giant, a sea, and a front door. Which of them would you keep? What would you make that no one has made yet?

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

Once, your Fighter waited alone near the bottom of an empty sea. Now it takes off from your own Title, and the whole sky is yours.

Free demo

Free

  • No time limit
  • Build, save and playtest your games
  • Follow every game guide and build its game

Publishing needs the full version.

Try the free demo

Full version

$84.99 USD, once

No subscription, no paid upgrades, every update included.

Everything in the free demo, plus:

  • Publish your game as one HTML file, a web folder, or desktop and mobile projects you build and sign
  • Share it or sell it, with no royalties, however much it earns
  • Let players build their own version of your game, within the parts you allow (Builder Mode)
Buy Myth Engine — $84.99

Windows 10/11, 64-bit · One person, on computers you own or control · Checkout and downloads through itch.io · Made by 3D Mage