- Learn
- Build a Game
- Pitch Shot
- 8 The Title and the Maps
8 The Title and the Maps
By the end of this chapter, Pitch Shot opens on its title painting. Press Play, choose a place, and choose a stage. Your stars show on the maps, and a back arrow takes you home.
The game as it is at the end of this chapter. Click the game, then press Enter to start.
If your game and this chapter part ways, here is the chapter’s finished project. Unzip it first. Open it to compare, or start Chapter 9 from it.
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.
8.1 The Idea
The meadow opens, the tower stands, and the notes sing. You know this place now. But the beach and the snowy peaks have been waiting in the tables since Chapter 1. Nobody has seen them yet.
This chapter opens the door. The title painting fills the screen, with Pitch Shot above a coral Play button. A tune begins. Press Play, and little pictures spread across the screen: a beach, autumn woods, a castle under the moon. Choose one, and its stages appear. The meadow is one place among many.
Each screen is a Scene, as the Field has been all along. Title welcomes you. Place Map offers places, and Stage Map offers stages. Choosing a stage opens the Field you built.
The maps look busy. You’ll only place their headings, buttons and Directors by hand. The map cards make themselves.
Think of a tray with a little label on each cup. The tray puts every cup in its spot, and the label says what belongs there. A map card gets a number, cardIndex, and every part reads that number to find its picture, words and stars. One card design becomes a whole map.
Every card is open for now, because the maps haven’t learned which stage comes next. Every place and stage opens when clicked. Chapter 9 gives the maps their order, and their keys.
8.2 The Plan
Here’s how the pieces meet. Bold names are Logic.
- Play, Enter or Space -> Open The Places -> Place Map.
- Choose The Next Stage finds the first stage without stars. Lay Out The Places makes the place cards, and Lay Out A Place Card makes their parts.
- Lay Out A Place Card makes each part and gives it cardIndex, then sends placed to it. Belong To A Place supplies placeIndex. Now its picture or stars can read that place number, ready to appear.
- A place is clicked -> Open A Place -> Stage Map. Lay Out The Stages and Lay Out A Stage Card make that place’s stage cards.
- A stage is clicked -> Open A Stage -> Field. Win The Stage keeps the best stars in Stages, ready for the maps to read.
- A back button -> Go Back -> the screen you came from.
Build the title first. Then give the maps their stars, and make the cards that will show them. The last part joins the Field to its new front door.
8.3 Set Up
Enter, SpaceEscapeHear It Again, Aim, Let Go, BackGo On, BackOpen#8FD3FFTitle · 2D#8FD3FF#8FD3FFThe Starter Kit brought ART and SOUNDS. Place Pictures is one sheet with a picture for each place. The tune is Music Title.
Make the Menus Input Context before Open, so Open goes into its Command Set. Its two keybindings are Enter and Space.
Back needs Field and Card. Select Field before adding Back, a Button Command with Escape as its keybinding. Then select Card. Its Reuse a Command… list offers Back; choose it, and press Add Keybinding to give this context Escape too. Keep Back out of Menus until Chapter 9. You make the Command once, then reuse it.
Open any Logic Component, and add the three Globals from its canvas’s Globals card. The music volume is $musicLevel, a quiet 0.45 that leaves room for the notes. Each place has $stagesPerPlace stages, 10 in all. The next stage, $nextStage, starts at 1. Each map finds the next stage without stars when it opens, so that first value won’t have to stay.
Make Title as a new Scene, with Dimension 2D. Give it the card’s Background Color, then choose Title in Game Settings > General > Startup > Start Scene. The Scene must exist before that list can offer it.
Make Place Map and Stage Map as 2D Scenes too, each with the listed Background Color. Leave their placements for later.
The back arrows will use the order the Scenes were made. They need Title, Place Map, Stage Map, then Field. Field was made first, so move its finished work to the end now.
Save your project before moving it. Select Field’s row in Resources, copy it with Ctrl+C, then press Delete and confirm Delete. The copy stays ready to paste. Clear the Resources search box, select Title’s resource row, and press Ctrl+V. The pasted Scene keeps Field’s placements and settings together, under the name Field2. Press F2, name that copy Field, and press Enter.
Earlier chapters restart the current Scene; they don’t name Field in a Scene list. Those Actions stay as they are. Later in this chapter, Open A Stage will choose the restored Field by name.
Check the move before saving again. Open Game Settings > General > Startup > Start Scene. Its list shows Title, Place Map, Stage Map, then Field, each marked 2D. After checking that order, select Field in Start Scene and run the game. Your tower, notes and win card should still work. Stop the game, then set Start Scene back to Title before saving. Something missing? Close this project without saving, reopen your saved project, and try the move again.
The Resources list displays names alphabetically. Start Scene’s list shows the stored order instead, the order the back arrows use. Chapter 8’s catch-up project already has that order if you’d like to compare.
8.4 The Front Door
First, the painting and its words. The maps can stay empty while the title takes shape.
8.4.1 Title Painting, Logo and Tagline
The Title Painting fills the world view, as the Backdrop does in the Field. It has no Logic. The Logo sits over it, fixed to the screen, with the game’s name.
X 19.2, Y 10.8Title Painting ArtX 19.2, Y 10.8Window / UIUIX 915, Y 238-1Logo ArtX 915, Y 238Make the Logo as a Screen UI Object. Remove its UI Interaction, because the name isn’t a button. Its Sprite is the lettering itself, so there’s no Text / UI to add. Z Index Within Object can stay at -1; this Logo has no words drawn over its Sprite.
The Tagline sits below the name. It tells you what to listen for before you touch the slingshot.
Window / UIUIX 1140, Y 64-1Tagline Pill ArtX 1140, Y 64Hear a note. Fling the happy note at the one that sings it.Nunito34Extra BoldCenterVectorX 0, Y 2Its Text is the game’s own sentence. Copy it from the card, and remove its UI Interaction so it doesn’t act as a button.
8.4.2 Play The Title Tune
The painting needs its tune. Play The Title Tune brings it in gently, over crossfadeSeconds, 1.5 seconds. It uses the Music bus, the same one that steps aside for a singing note in the Field.
It also hands the keys to Menus. Field and Card go off, so Enter won’t try to fling a note behind the title. You’ll use this Logic on both maps too.
When the Title starts, the title tune plays at the game's music level, and the menu keys work.
Any Object- Input Context
Menus
- Input Context
Field- Active
No
- Input Context
Card- Active
No
- Audio Bus
Music- Volume
$musicLevel
- Operation
Crossfade Music- Sound
Music Title- Crossfade Seconds
@self.crossfadeSeconds
Control Sound’s Operation list has Crossfade Music. Pick it, then choose Music Title in the Sound list, ready to fade in as the title opens. Set Volume sets the Music bus to $musicLevel, the Global from Set up.
8.4.3 The Title Director
One Empty Object holds that Logic. It has no picture, as Game Rules has none. The Director’s work is heard.
8.4.4 Open The Places
A click on Play and a press of Enter should open the same door. Both send opened to the button itself. One Event hears that message, plays Sound Click, and changes Scenes.
The Play button, and Enter or Space on the Title (the Open Command): goes to the Place Map.
Any Object- Custom Event
opened
- Custom Event
opened
- Sound
Sound Click
- Scene
Place Map- Transition
Fade- Transition Seconds
@self.fadeSeconds
On Hud Activated is Myth’s heading for UI Activated, as on the Listen Button in Chapter 2.
Go to Scene opens another Scene from its Scene list, with a transition between the two. Pick Place Map, with Fade as its Transition. The fade takes fadeSeconds, 0.25 seconds, a brief blink between screens. The two Events above it both use Trigger Custom Event on Object, so only this button hears opened.
8.5 The Maps Remember This Run
Before a map can count your stars, the Field must leave them somewhere to read.
8.5.1 Stage and Stages, Changed
Add stars to Stage, a Number starting at 0. Each stage’s row can now keep its best result.
One stage: its place, its name, how far apart its notes sit, and where its towers and singing notes are in the Tower Plans and Notes tables.
Sunny MeadowLow and high1201020Sunny MeadowHilltop echo611220Sunny MeadowTwo voices1221420Leave Stages’ rows alone. Adding stars to its Entry Type, Stage, gives the table its new column. Each row starts with that field’s default of 0. Stages still has 120 rows.
The IMPORT CSV line remembers the file you used in Chapter 1. That file has no stars column, so there’s nothing new to import here. A fresh game has no stars.
8.5.2 Win The Stage, Changed
The win still counts stars as before. Now it compares them with the stars already kept in this stage’s row. A better result replaces the old one. A worse result leaves it alone.
Finding the called note wins the stage: the game is Stage Won, and the stage earns stars for listening. The Stages table keeps the best stars of each stage.
Any Object- Game State
Playing
- Input Context
Field
- Input Context
Card- Active
No
- Input Context
Menus- Active
No
- Game State
Stage Won
$wrongNotes == 0- Variable
$starsWon- Value
3
$wrongNotes <= @self.twoStarWrongNotes- Variable
$starsWon- Value
2
- Variable
$starsWon- Value
1
$starsWon > data("Stages", $stage - 1, "stars")- Table
Stages- Row
$stage - 1- Column
"stars"- Value
$starsWon
The last If goes after the whole star-counting If, on the Event’s main line. It must run whichever branch counted the stars. Set Data Cell writes the better result into Stages, picked from its Table list. Its Row is $stage - 1, because the first stage lives in row 0.
At Scene Start, Menus goes off too. The Field gets its keys back when you leave a map.
These stars last while the game runs. Chapter 10 will make them stay after you close the window and open the game again.
8.6 A Place for Every Picture
Now the Place Map. Build the little parts first, then the card that makes them, and last the Director that makes the cards. Nothing shows until that Director is placed.
8.6.1 Map Spot
Every part needs to know which card it belongs to. That’s Map Spot. Its cardIndex is the number handed over by whoever made it. Its other fields keep what the part learns from that number.
What the Logic of one part of a map card shares: its card number on the map (cardIndex, told by whoever made it), its place (on the Place Map) or its stage (on the Stage Map), how many of the place's stars are earned, which of a stage card's stars it is.
Make it once. Each Logic that names it brings a copy to its Object, as Note State came to the singing notes.
8.6.2 Belong To A Place
The first place card has cardIndex 0. That’s also the first row of Places, so this Logic copies cardIndex into placeIndex. Every part of the card can now look up its place.
One part of a place card: from its card number (cardIndex, 0 to 11) it keeps its place in placeIndex. It reads cardIndex (its Map Spot), set by Lay Out The Places (the card) or Lay Out A Place Card (its other parts), when it makes the part.
Any Objectself.mapSpot- Component Value
self.mapSpot.placeIndex- Value
self.mapSpot.cardIndex
It waits for placed, not Create. The maker fills in cardIndex after Create Instance, then sends placed when the number is ready. You’ve used that hand-off for the singing notes.
8.6.3 Show The Place Picture
The beach’s card should show the beach. Place Pictures holds all the little paintings in the Places table’s order. Set Frame chooses the painting at placeIndex.
The picture of one place on its card (frame n is place n). It reads placeIndex (its Map Spot), set by Belong To A Place, attached first.
Any Objectself.mapSpot- Frame
self.mapSpot.placeIndex
8.6.4 The Place Picture and Place Name
The picture is a world Object. It sits above the card’s middle, and its draw order puts it in front of the card.
X 2.56, Y 1.4411Place PicturesX 2.56, Y 1.44Belong To A Place, Show The Place PictureMap SpotAttach Belong To A Place first, then Show The Place Picture. Both hear placed. The first gives the part its placeIndex before the second reads it.
The name is a Screen UI Object with text, as the Stage Title was. Its template reads the name from Places using placeIndex. Copy the braces and the formula from the card.
Window / UIUIX 270, Y 40{data("Places", placeIndex, "name")}Nunito27Extra Bold#3A1D0BCenterVectorBelong To A PlaceMap SpotRemove the name’s UI Interaction. Attach Belong To A Place; its Map Spot fields are available to the text template under their plain names.
8.6.5 The Place Star
One golden star sits beside the count. It stays lit, because it’s the label for the total, rather than a result for one stage.
X 0.34, Y 0.3412Star Art1X 0.34, Y 0.34Pick Star Art in the Sprite’s Appearance, and type 1 into Frame there. That’s the lit picture. This star has no Logic and no Map Spot.
8.6.6 Count The Place’s Stars
A place has several stages. This Logic adds their stars into one count, starsEarned, for the place’s card. The Repeat visits the place’s rows in Stages, starting at its first stage.
How many of a place's stars (3 for each of its $stagesPerPlace stages) have been earned, shown on its card ("<n> of 30"). It reads placeIndex (its Map Spot), set by Belong To A Place, attached first.
Any Objectself.mapSpot- Name
stageRow- Value
0
- Component Value
self.mapSpot.starsEarned- Value
0
$stagesPerPlacetimes- Variable
stageRow- Value
self.mapSpot.placeIndex * $stagesPerPlace + local.index
- Component Value
self.mapSpot.starsEarned- Operator
+=- Value
data("Stages", stageRow, "stars")
stageRow is a Declare Variable for this one count. The lasting total lives in Map Spot, where the card’s text can read it.
8.6.7 The Place Stars
The count sits beside the golden star. Its template joins starsEarned to the largest possible total: $stagesPerPlace * 3. A fresh place reads 0 of 30.
Window / UIUIX 150, Y 34{starsEarned} of {$stagesPerPlace * 3}Nunito23Extra Bold#3A1D0BCenterVectorBelong To A Place, Count The Place's StarsMap SpotAttach Belong To A Place before Count The Place’s Stars. Remove the UI Interaction.
8.6.8 Open A Place
A place card uses two frames here: plain, and highlighted. When placed arrives, it lights if it contains $nextStage, the next stage without stars. A click opens Stage Map. The place’s first stage becomes $stage, ready for that map to find the place you chose.
One place card: highlighted when the stage to play next ($nextStage) is in its place; clicking it opens the place's Stage Map. It reads placeIndex (its Map Spot), set by Belong To A Place, attached first (cardIndex by Lay Out The Places, when it makes the card).
Any Objectself.mapSpotfloor(($nextStage - 1) / $stagesPerPlace) == self.mapSpot.placeIndex- Frame
1
- Frame
0
- Sound
Sound Click
- Variable
$stage- Value
self.mapSpot.placeIndex * $stagesPerPlace + 1
- Scene
Stage Map- Transition
Fade- Transition Seconds
@self.fadeSeconds
This click is Mouse Pressed on Object, unlike a Screen UI button’s UI Activated. Choose left as its Mouse button. Its Bounding Box lets the Sprite-only card receive the click without a Collider. Events: the When bars shows where that choice lives.
8.6.9 Lay Out A Place Card
Each map card makes its own picture, name, star and count. Each starts from the card’s middle, then moves by the offsets on this card. Change pictureAbove, for instance, and every picture moves together.
When the card is placed, makes the rest of it around its middle: the place's picture, its name, a star and the count of its stars, each told the card's number. It reads cardIndex (its Map Spot), set by Lay Out The Places, when it makes the card.
Any Objectself.mapSpot- Object to Create
@self.placePicture- X
self.transform.position.x- Y
self.transform.position.y + @self.pictureAbove- Variable Name
newPicture
- Variable
newPicture.cardIndex- Value
self.mapSpot.cardIndex
- Applies to
newPicture- Custom Event
placed
- Object to Create
@self.placeName- X
0- Y
0- Variable Name
newName
- Applies to
newName- X
self.transform.position.x- Y
self.transform.position.y - @self.nameBelow
- Variable
newName.cardIndex- Value
self.mapSpot.cardIndex
- Applies to
newName- Custom Event
placed
- Object to Create
@self.placeStar- X
self.transform.position.x - @self.starLeft- Y
self.transform.position.y - @self.starsBelow- Variable Name
newStar
- Object to Create
@self.placeStars- X
0- Y
0- Variable Name
newStarCount
- Applies to
newStarCount- X
self.transform.position.x + @self.countRight- Y
self.transform.position.y - @self.starsBelow
- Variable
newStarCount.cardIndex- Value
self.mapSpot.cardIndex
- Applies to
newStarCount- Custom Event
placed
The name and count are screen text. They start at the screen’s corner, then Set Position moves each to where its point in the world shows. Leave Set Position’s coordinate space at World. Set Position handles the crossing from meters to screen pixels.
Each part that needs a number gets cardIndex before placed arrives. A newPicture.cardIndex reads Map Spot’s field through its short name, as newDot.dotNumber did in Chapter 3. The little golden star needs neither. It has no number to read and no decision to make, so it needs no Map Spot.
8.6.10 The Place Card
The parts are ready. Make their card as a world Object, with Place Card Art, and attach its Logic in the order shown.
X 2.86, Y 2.6810Place Card ArtX 2.86, Y 2.68Belong To A Place, Open A Place, Lay Out A Place CardMap SpotPlace PicturePlace NamePlace StarPlace StarsBelong To A Place comes first. Open A Place and Lay Out A Place Card read the place number it sets. Give the Object’s Variables their choices from the card. The design has its parts.
Don’t place a Place Card in the Scene. Its Director makes the whole map from this one Object, giving every card its number.
8.6.11 Choose The Next Stage
The maps need somewhere to point. Choose The Next Stage searches Stages for the first row whose stars are 0. That’s the next stage to play. If every row has stars, it chooses the last stage instead.
When a map opens, $nextStage is the stage to play next: the first stage without stars, or the last stage when every stage has some (the maps highlight it). On the Place Map it also becomes $stage, so the map shows its place.
Any Object- Name
rowWithoutStars- Value
-1
- Variable
rowWithoutStars- Value
dataFind("Stages", "stars", 0)
rowWithoutStars >= 0- Variable
$nextStage- Value
rowWithoutStars + 1
- Variable
$nextStage- Value
dataCount("Stages")
self.selectIt == true- Variable
$stage- Value
$nextStage
dataFind returns -1 when no row matches. That sends the If to its Otherwise branch, which chooses the last stage. It keeps that answer in $nextStage. On Place Map, it also sets $stage, so the backdrop belongs to the place you’re heading for.
selectIt is a Per Instance Variable, as starNumber was in Chapter 7. Leave it Yes here. Stage Map will set its own placement to No, because you already chose a place.
8.6.12 Lay Out The Places
The map lays itself out from left to right. At columns cards it starts again on the left, one row lower, until every place has its spot. The Places table decides how many cards there are.
When the Place Map is made, lays out a card for each place (each row of the Places table): columns cards to a row from the top left, each told its number (cardIndex).
Any Object- Name
cardX- Value
0
- Name
cardY- Value
0
dataCount("Places")times- Variable
cardX- Value
@self.firstCardX + mod(local.index, @self.columns) * @self.across
- Variable
cardY- Value
@self.firstCardY - floor(local.index / @self.columns) * @self.down
- Object to Create
@self.placeCard- X
cardX- Y
cardY- Variable Name
newCard
- Variable
newCard.cardIndex- Value
local.index
- Applies to
newCard- Custom Event
placed
The two sums are the tray’s slots. mod counts across a row, starting over at each new row. floor counts how many whole rows have gone before this card. One moves across; the other moves down.
Choose The Next Stage runs on Scene Start. This Logic runs on Create, after Scene Start, so $nextStage is ready before any card reads it.
8.6.13 The Places Director
The Empty Object carries the tune, the choice, and the layout. Set placeCard to Place Card under Variables on the Director, so it knows which Object to make. That one choice supplies every card on the map.
Place Card8.6.15 Go Back
The back arrow works like Play: the click and the key meet in one Event. This time the message is goBack. Previous Scene opens the preceding Scene in the project’s stored order. It has no boxes to fill. That order is Title, Place Map, Stage Map, Field, from Set up. So the Field’s arrow always leads to Stage Map.
The back arrow and the Map button (and Escape): go back one screen (Field to Stage Map, Stage Map to Place Map, Place Map to Title).
Any Object- Custom Event
goBack
- Custom Event
goBack
- Sound
Sound Click
Window / UIUIX 96, Y 102-1Back Icon ArtX 96, Y 102Keep the UI Interaction. Attach Go Back. On Hud Activated is Myth’s heading for UI Activated, as on the Listen Button in Chapter 2. On the maps, use the arrow. Escape is in Field and Card for now; Chapter 9 adds it to Menus too.
Now the Place Map’s PLACE THESE. Reuse the Backdrop from Chapter 1. Place Shade and Places Director at their World Positions, then the heading and the three buttons at their Screen Offsets. The Backdrop will pick the place through $stage, as it does in the Field.
Run the game, press Play, and the pictures spread into rows. The first place is highlighted. Its count says 0 of 30. Click the back arrow, and you’re home at the title.
Click a place again, and Stage Map opens empty. Its cards come next.
8.7 A Stage Behind Every Card
This map repeats the idea, one step deeper. A card’s number now belongs to a place, so it needs the place’s first stage too.
8.7.1 Belong To A Stage
A Stage Map offers only the stages of the place you chose. Belong To A Stage finds that place’s first stage, then counts forward by cardIndex. The answer is stageNumber.
One part of a stage card: from its card number (cardIndex, 0 to 9) its stage is cardIndex + 1 of the place shown, kept in stageNumber. It reads cardIndex (its Map Spot), set by Lay Out The Stages (the card) or Lay Out A Stage Card (its other parts), when it makes the part.
Any Objectself.mapSpot- Name
firstStage- Value
1
- Variable
firstStage- Value
floor(($stage - 1) / $stagesPerPlace) * $stagesPerPlace + 1
- Component Value
self.mapSpot.stageNumber- Value
firstStage + self.mapSpot.cardIndex
The first card has index 0, but stage numbers begin at 1. The card’s sum includes that small step. You’ll attach this Logic first on each stage part, before anything reads its stageNumber.
8.7.2 Stage Number and Stage Name
Both are Screen UI Objects with text, carrying Belong To A Stage. One shows stageNumber itself. The other reads that stage’s name from Stages, one row back from its number.
Window / UIUIX 200, Y 64{stageNumber}Nunito56Extra Bold#3A1D0BCenterVectorBelong To A StageMap SpotWindow / UIUIX 310, Y 34{data("Stages", stageNumber - 1, "name")}Nunito22Extra Bold#3A1D0BCenterVectorBelong To A StageMap SpotRemove their UI Interactions. Copy each Text template from its card, braces and all.
8.7.3 Light A Stage Star
The stars look familiar. Each asks whether this stage earned at least its own starNumber. Two earned stars light the first two, and leave the last dim, as on the win card.
One of the three stars on a stage card (its starNumber, 1 to 3, told by the card that made it): lit when the stage has earned at least that many stars. It reads stageNumber and starNumber (its Map Spot), set by Belong To A Stage, attached first (starNumber by Lay Out A Stage Card, when it makes the star).
Any Objectself.mapSpotdata("Stages", self.mapSpot.stageNumber - 1, "stars") >= self.mapSpot.starNumber- Frame
1
- Frame
0
This time the count comes from Stages. starNumber lives in Map Spot, because the card that makes the stars will fill it in.
8.7.4 The Stage Star
Make one world Object, shared by every stage card’s stars. Belong To A Stage gives it its stage, and Light A Stage Star picks its frame. Keep those Logic Components in that order.
X 0.4, Y 0.412Star ArtX 0.4, Y 0.4Belong To A Stage, Light A Stage StarMap SpotLogic makes all the stars when the map opens, so none are placed by hand.
8.7.5 Open A Stage
The map offers little doors back into the game. Each has its own stage number. Open A Stage passes that number to $stage before opening Field. The highlighted door points to $nextStage.
A stage card: highlighted when it is the stage to play next; clicking it starts that stage. It reads stageNumber (its Map Spot), set by Belong To A Stage, attached first (cardIndex by Lay Out The Stages, when it makes the card).
Any Objectself.mapSpotself.mapSpot.stageNumber == $nextStage- Frame
1
- Frame
0
- Sound
Sound Click
- Variable
$stage- Value
self.mapSpot.stageNumber
- Scene
Field- Transition
Fade- Transition Seconds
@self.fadeSeconds
8.7.6 Lay Out A Stage Card
The card makes its number and name, then its stars. The stars share one picture, but each gets its own starNumber before placed arrives. Their spacing spreads them around the card’s middle.
When the card is placed, makes the rest of it around its middle: the stage's number and name, its three stars, each told the card's number (and each star which it is). It reads cardIndex and starNumber (its Map Spot), set by Lay Out The Stages, when it makes the card.
Any Objectself.mapSpot- Object to Create
@self.numberLabel- X
0- Y
0- Variable Name
newNumber
- Applies to
newNumber- X
self.transform.position.x- Y
self.transform.position.y + @self.numberAbove
- Variable
newNumber.cardIndex- Value
self.mapSpot.cardIndex
- Applies to
newNumber- Custom Event
placed
- Object to Create
@self.nameLabel- X
0- Y
0- Variable Name
newName
- Applies to
newName- X
self.transform.position.x- Y
self.transform.position.y - @self.nameBelow
- Variable
newName.cardIndex- Value
self.mapSpot.cardIndex
- Applies to
newName- Custom Event
placed
3times- Object to Create
@self.stageStar- X
self.transform.position.x + (local.index - 1) * @self.starSpacing- Y
self.transform.position.y - @self.starsBelow- Variable Name
newStar
- Variable
newStar.cardIndex- Value
self.mapSpot.cardIndex
- Variable
newStar.starNumber- Value
local.index + 1
- Applies to
newStar- Custom Event
placed
The Description mixes the two layouts’ jobs. Follow the Actions: this card’s Repeat supplies starNumber to each star, while Lay Out The Stages supplies the parent’s cardIndex. You may describe that in your own words. Descriptions don’t run.
The Repeat makes the stars. Its index begins at 0, so starNumber gets local.index + 1. The Set Positions for the two texts work as they did on the place card.
8.7.7 The Stage Card
The waiting stage card has no words or stars of its own yet. Its Variables name the parts it will make. Keep Belong To A Stage first, so the rest receive the stage it belongs to.
X 3.3, Y 2.0210Stage Card ArtX 3.3, Y 2.02Belong To A Stage, Open A Stage, Lay Out A Stage CardMap SpotStage NumberStage NameStage Star8.7.8 Lay Out The Stages
This is the tray again. This time it uses stageCard and five columns, with $stagesPerPlace cards to make. The wider cards leave room for their names.
When the Stage Map is made, lays out a card for each stage of the place shown: columns cards to a row from the top left, each told its number (cardIndex).
Any Object- Name
cardX- Value
0
- Name
cardY- Value
0
$stagesPerPlacetimes- Variable
cardX- Value
@self.firstCardX + mod(local.index, @self.columns) * @self.across
- Variable
cardY- Value
@self.firstCardY - floor(local.index / @self.columns) * @self.down
- Object to Create
@self.stageCard- X
cardX- Y
cardY- Variable Name
newCard
- Variable
newCard.cardIndex- Value
local.index
- Applies to
newCard- Custom Event
placed
8.7.9 The Stages Director and Stages Heading
The Director carries the same tune and next-stage choice as Places Director, with the stage layout in place of the place layout. Set stageCard to Stage Card under Variables.
Stage CardThe heading reads the place’s name using $stage. No Logic needs to copy the name into the text, because its template reads the table itself. Copy the Text template, then remove the UI Interaction. Its 10 is the count this template uses to find a place’s first stage. Keep it as shown; the table lookup allows formulas too.
Window / UIUIX 900, Y 80{data("Places", floor(($stage - 1) / 10), "name")}Nunito56Extra BoldCenterVectorNow Stage Map’s PLACE THESE. Reuse Backdrop, Shade and the three buttons. The new Director and heading go at their own positions, where the Place Map had its pair. On this Director’s placement, open Per Instance Variables and set Select It to No. Otherwise its next-stage choice would replace the place you clicked.
Run the game and choose a place. Its name appears above its stages. Click a stage. The map fades, its painting fills the screen, and its notes sing their opening.
You’ve come back to the game you built.
8.8 The Way Home
Last, the Field needs a way back to its map, and its tune needs the same music level as the menus.
8.8.2 Make Way For The Notes, Changed
The menu tune and the Field’s tune now share $musicLevel. Make Way For The Notes uses it when the Scene starts, and as the singing fades the tune down and back up.
Keeps the music quiet under the notes ($musicLevel), fades it down while a note sings and brings it back afterwards, so the notes are always heard clearly.
Any Objectself.makeWayForTheNotesData- Component Value
self.makeWayForTheNotesData.loudness- Value
1
- Component Value
self.makeWayForTheNotesData.targetLoudness- Value
1
- Audio Bus
Music- Volume
$musicLevel- Volume
@self.musicVolume
- Component Value
self.makeWayForTheNotesData.targetLoudness- Value
0
- Timer Name
"musicBack"- Repeat Every (s)
@self.holdSeconds- Ring Once
Yes
- Timer Name
"fadeMusic"- Repeat Every (s)
@self.stepSeconds- First Delay (s)
@self.stepSeconds
- Component Value
self.makeWayForTheNotesData.targetLoudness- Value
1
- Timer Name
"fadeMusic"- Repeat Every (s)
@self.stepSeconds- First Delay (s)
@self.stepSeconds
self.makeWayForTheNotesData.loudness > self.makeWayForTheNotesData.targetLoudness- Component Value
self.makeWayForTheNotesData.loudness- Value
max(self.makeWayForTheNotesData.targetLoudness, self.makeWayForTheNotesData.loudness - @self.stepSeconds / @self.secondsToFadeOut)
self.makeWayForTheNotesData.loudness < self.makeWayForTheNotesData.targetLoudness- Component Value
self.makeWayForTheNotesData.loudness- Value
min(self.makeWayForTheNotesData.targetLoudness, self.makeWayForTheNotesData.loudness + @self.stepSeconds / @self.secondsToFadeIn)
- Audio Bus
Music- Volume
self.makeWayForTheNotesData.loudness * $musicLevel- Volume
self.makeWayForTheNotesData.loudness * @self.musicVolume
self.makeWayForTheNotesData.loudness == self.makeWayForTheNotesData.targetLoudness- Timer Name
"fadeMusic"
Each Set Volume still has one Volume box. Use the green formula first. The fade still works as it did in Chapter 2.
Then remove musicVolume using its trash button on the canvas’s Shared Variables card. The menus share that job now, through $musicLevel, so the old value has nothing left to do.
Run the game. Choose a place and stage, then click the Map Button. Stage Map returns. Its back arrow goes to Place Map, and the next goes to Title.
Watch each door open, and listen as the tune changes.
- The game opens on the title painting, with the logo, tagline and Play button. The tune comes in gently.
- Click Play, or press Enter or Space. Place Map shows two rows of pictures, with Choose a place above them.
- A new game’s place counts read 0 of 30. The place containing the next stage is highlighted.
- Click the beach’s card. Stage Map shows its name, stage numbers and names, and dim stars. Click any stage there, and the beach opens behind its towers.
- Win a stage. Its stars are kept for this run. Return to its map, and that stage’s stars show the result.
- The Map Button returns to Stage Map. From there, the back arrow leads through Place Map to Title, one screen at a time.
- Press Escape in the Field, and it returns to the map too. Use the arrows on the maps for now.
- Click Sound or Motion. Their pictures are there, but their choices wait for Chapter 10.
The Director makes cards. Each card gets a number, then makes its own parts. The parts use that number to find a picture, a name or a count. A click opens the Field. The Field leaves its best stars in Stages, ready for the maps to read.
Underneath it is the same idea as the towers: make one design, then give each copy its own data. The layout decides where a card stands. Its number decides what it means.
8.9 If It Didn’t Work
With so many little parts, a missing label can leave the right card showing the wrong words. Look for the first place where the picture parts company with the plan.
The Field still opens first? Look at Start Scene under General > Startup. The list should have Title picked, so the game starts at its front door.
Play opens an empty map? Is Places Director placed in Place Map, and is placeCard set to Place Card under its Variables? The Director makes the cards, so a missing Director leaves a blue screen.
Every place shows the same picture? Look at the Place Picture’s Attached Logic. Belong To A Place goes before Show The Place Picture. And does Lay Out A Place Card give each newPicture its cardIndex before sending placed?
The back arrow opens the wrong Scene? Look at the order from Set up. Previous Scene uses the project’s stored order, which is separate from the alphabetical Resources list. Put Field last with the copy-and-paste move there, or compare with this chapter’s catch-up project. The back arrows lead home.
The picture is right, but the name is missing? Look at Place Name’s Text template and its Map Spot. Attach Belong To A Place to the name before you test it, so its Map Spot gets filled in. The picture and the name each need their own cardIndex before placed arrives.
You click the beach, but Sunny Meadow’s stages appear? Look at Stages Director’s placement. Set Select It to No under Per Instance Variables. Now the place you clicked stays chosen, instead of being replaced by the next stage without stars.
Every stage’s stars look the same? Look at Lay Out A Stage Card’s newStar.starNumber, and at Light A Stage Star on Stage Star. Each star needs both its stage number and its own number.
Escape does nothing on a map? That’s expected in this chapter. Use the back arrow; Menus gets Back in Chapter 9. If Escape does nothing in the Field, add Back to both Field and Card’s Command Sets.
Each of these is one small fix. Make it, open the map again, and see which part changed. The catch-up download in the Goal has this chapter’s finished game if you’d like to compare.
The cards are yours to arrange. Change pictureAbove in Place Card’s Variables from 0.44 to 0.65, and every place picture rises together. Or change crossfadeSeconds on Title Director from 1.5 to 6, and let the title tune arrive more slowly. What would you change to make your own game’s front door? Put the values back before Chapter 9.
Still stuck? Search the manual, or ask in the Myth Engine Discord (opens a new tab).
You can step from the title into any place, and find your way home again. In Chapter 9, the maps learn which one opens next.
