- Learn
- Build a Game
- Sky Ace
- 9 The Sky Fortress
9 The Sky Fortress
The Sky Fortress comes. A WARNING blinks, a siren wails, and the music turns. A long gray giant comes down under its own health bar and fires fans of shells. Hurt it to half, and it rages, with rings of shells and Zero Fighter escorts. Bring it down, and it sinks in a chain of explosions, and MISSION COMPLETE: THE SKY FORTRESS HAS FALLEN.
The game as it is at the end of this chapter. Click the game to play.
This chapter builds on Chapter 8’s game. Starting here? The catch-up download in Chapter 8’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, or start Chapter 10 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. Beside it, OFL.txt is the license of the project’s font, Bebas Neue.
9.1 The Idea
Wave 4 is over. The HEAVY SQUADRON has come and gone, and the sky is quiet for a moment. Then STAGE says BOSS. A siren wails, and a banner striped in black and yellow blinks in the middle of the screen: WARNING, HEAVY SKY FORTRESS APPROACHING. The Battle Theme stops, and the Boss Theme starts.
A long gray giant slides down from the top, with a row of round domes down its back. It’s four times the size of a Heavy Bomber. A bar appears at the top of the window, SKY FORTRESS, full and red. The giant stops, drifts from side to side, and opens fire.
This is the last enemy. Everything you’ve built meets it: your guns, your bombs, your medkits.
It isn’t another plane, though. A Heavy Bomber takes its hits and goes down. The Sky Fortress has a fight with a shape.
It comes down untouchable. Then it fights. At half its health it becomes enraged, the game’s word for its second, angrier way of fighting. And when its health is gone, it doesn’t vanish. It sinks.
So this chapter’s idea is switching Logic on and off. The Sky Fortress carries everything it will ever do from the start, but most of it is switched off. As the fight goes on, its own Logic switches pieces on and off: the guns of the first half off, the angrier guns on.
Think of a ship’s crew at stations. Every gunner is aboard from the start. Each one waits for the order to man the guns, and not one fires before it comes.
The order comes as a message. The Sky Fortress’s meter reaches a mark, and one piece of Logic gives the orders.
There’s a health bar too, at the top of the window, that shrinks with every hit. And when the giant falls, the mission is won. Your game gets its second ending, the one where you win.
9.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 Boss row’s time comes -> Run Waves sends fortressWarning -> the WARNING blinks, with the Warning Siren, and Mission Music plays the Boss Theme.
- The Sky Fortress’s row comes -> Make a Row Arrive makes it -> Sky Fortress Battle sends fortressArrived, and the health bar shows.
- The Sky Fortress reaches fightY -> Sky Fortress Battle switches on Takes Hits, Patrol and Fortress Guns.
- A round hits it -> Takes Hits counts it and sends hitCounted -> Sky Fortress Battle sends fortressDamaged -> the bar shrinks.
- The meter reaches half -> Sky Fortress Battle’s Enraged switches the guns, sends fortressEnraged -> the ENRAGED banner shows, and Calls Escorts sends Zero Fighters.
- The meter reaches full -> Go Down sends fortressDown -> enemy rounds break, and the Sky Fortress sinks.
- It has sunk -> fortressSunk -> Mission Complete wins the mission -> everything that watches the Game State answers.
9.3 Set Up
This chapter uses seven more pictures and four more sounds. They’re in your project already.
There’s one more Game State, Mission Complete. Open the Game Settings, choose General, and press the + under the Game State list. Type Mission Complete, as you did for Mission Failed in Chapter 4.
PLACE THESE lists seven Objects this chapter makes. Place each one in the part that makes it. CHANGE THESE PLACEMENTS and REMOVED come in the last part, Mission complete.
Don’t delete Mission Failed when you reach REMOVED. In that part it gets a new name, and keeps its blocks.
Playing, Mission Failed, Mission Complete9.4 The Warning
First, the warning.
9.4.1 Waves
The Waves table gets a fifth row, for the Sky Fortress. Its label is BOSS, so STAGE says BOSS when it starts, and its startSeconds is 112.
Its banner is empty, because no banner strip rolls in for it. Something else shows instead. So the table gets one more column, warning, a Yes/No. Only the Boss row says Yes.
The table’s columns come from its Data Structure, Waves Entry, from Chapter 6. So open Waves Entry, press Add Field, and type warning over localVariable. Pick Boolean in its Type list, and its Value becomes a switch reading No, the card’s false. The Waves table takes the column by itself, as Enemy Types took bigExplosion in Chapter 7, and every row’s switch reads Off.
One row of the "Waves" Data Table.
Then Add Row. Myth names the new row Row, so double-click the name and type Boss. Give it its values. Leave its banner empty, as a new row starts, and switch its warning On.
1WAVE 1WAVE 1 - CORAL SEA PATROLNo26WAVE 2WAVE 2 - ACES HIGHNo52WAVE 3WAVE 3 - DIVE BOMBERSNo80WAVE 4WAVE 4 - HEAVY SQUADRONNo112BOSSYes9.4.2 Run Waves
When a wave’s time comes, Run Waves raises its banner with waveStarted. Now it asks a question first. Is this row a warning? If it is, Run Waves sends fortressWarning instead of waveStarted, and no banner rolls in.
On the Changes card, the old Trigger Custom Event is struck, and in its place comes a new If, step 5, with its Else. The rest stays.
Right-click the old Trigger Custom Event, choose Delete, and then add an If from the Action List. It lands loose, beside the line. It goes in the middle of the outer If’s True line, where the old block was. So drag it onto the arrow between the banner’s Change Variable and Change Component Value. Hold it there. The bar under the canvas names the two blocks it will go between. Let go, and it joins the line there.
Its condition is one box. Type it whole: data("Waves", self.runWavesData.nextWave, "warning") == true, the row’s warning.
Right-click the new If, and Add inside Then adds Trigger Custom Event, with fortressWarning. Then Add Else, and Add inside Else adds the other Trigger Custom Event, for waveStarted. Join each with Connect to sequence.
Starts each wave of the Waves table at its mission time: the HUD shows it and its banner is raised.
Any Objectself.runWavesData- Variable
$wave- Value
data("Waves", self.runWavesData.nextWave, "label")
- Timer Name
wave- First Delay (s)
data("Waves", self.runWavesData.nextWave, "startSeconds") - $missionTime- Ring Once
Yes
- Action Name
stillPlaying- Game State
Playing
stillPlaying.value == true- Variable
$wave- Value
data("Waves", self.runWavesData.nextWave, "label")
- Variable
$banner- Value
data("Waves", self.runWavesData.nextWave, "banner")
- Custom Event
waveStarted
data("Waves", self.runWavesData.nextWave, "warning") == true- Custom Event
fortressWarning
- Custom Event
waveStarted
- Component Value
self.runWavesData.nextWave- Operator
+=- Value
1
self.runWavesData.nextWave < dataCount("Waves")- Timer Name
wave- First Delay (s)
data("Waves", self.runWavesData.nextWave, "startSeconds") - $missionTime- Ring Once
Yes
9.4.3 Mission Music
The music turns when the warning comes. Mission Music gets a new Event, On Fortress Warning, which stops the Battle Theme and loops the Boss Theme. Run Waves sends fortressWarning now, so Add Event’s window knows the name. Type it into the filter, and pick it.
The end of the mission changes too, for the win that comes later in this chapter. On Game State Changed asks one more question. Add a new Check Game State, type missionComplete over its Action Name, and pick Mission Complete in its list. It goes second, so drag it onto the arrow between the first Check Game State and the If, as you did for Shot Down in Chapter 8.
The If’s condition grows a second part. Click its box, and type the card’s whole condition over the old one: missionFailed.value == true || missionComplete.value == true. The || means or. Now the If’s line runs when the mission is lost or won, not only lost.
Inside it are the three Control Sounds that stopped the music. They’re steps 4, 5 and 6 now. Keep all three, and change what two of them do. Changing the old ones is the short way.
Step 5 stopped the Engine Drone. Now it stops the Boss Theme, so pick Boss Theme in its Sound list. Step 6 is the one that played the Game Over Jingle, and now it stops the Engine Drone. Pick Stop in its Operation, and Engine Drone in its Sound. On the card, step 6’s old Sound is struck above its two green lines.
Last comes a new If, with an Else. It asks which ending it was. The outer If’s Add inside Then adds it at the end of its line, where it belongs. A lost mission plays the Game Over Jingle. A won mission plays the Victory Jingle, the first time you’ll hear it.
Plays the Battle Theme and the engine drone during the mission, and the Game Over Jingle when it fails.
Any Object- Operation
Loop- Sound
"Battle Theme"
- Operation
Loop- Sound
"Engine Drone"
- Action Name
missionFailed- Game State
Mission Failed
missionFailed.value == true- Action Name
missionComplete- Game State
Mission Complete
missionFailed.value == true || missionComplete.value == true- Operation
Stop- Sound
"Battle Theme"
- Operation
Stop- Sound
"Boss Theme"- Sound
"Engine Drone"
- Sound
"Game Over Jingle"- Operation
Stop- Sound
"Engine Drone"
missionFailed.value == true- Sound
"Game Over Jingle"
- Sound
"Victory Jingle"
- Operation
Stop- Sound
"Battle Theme"
- Operation
Loop- Sound
"Boss Theme"
9.4.4 Blink
The WARNING banner doesn’t sit still. It blinks: it shows for a moment, hides, and shows again, until the warning is over.
Blink makes any Object blink while it’s switched on. Its blinkOn timer rings every blinkGap seconds and shows the Object. Each time, a second timer, blinkOff, rings once, showSeconds later, and hides it.
Two Events start the blinkOn timer. When Created starts it if Blink is on as the Object appears. On Enable starts it whenever other Logic switches Blink on, even long after the Object appeared.
Its partner, On Disable, runs when Blink is switched off, and stops the blinkOn timer and hides the Object. In the Add Event window they’re On Enable and On Disable, and Myth names them When Enabled and When Disabled.
Make its three SHARED VARIABLES first, all Constants. The Timer Names take blinkOn and blinkOff bare, and Set Visible’s Visible is a list that starts on No. Pick Yes in the one under the blinkOn timer’s Event, and leave the other two. The blinkOff timer rings once, so its Ring Once is Yes.
While on, shows this Object every blinkGap seconds (first after firstShow) for showSeconds, and keeps it hidden in between.
Any Object- Timer Name
blinkOn- Repeat Every (s)
@self.blinkGap- First Delay (s)
@self.firstShow
- Timer Name
blinkOn- Repeat Every (s)
@self.blinkGap- First Delay (s)
@self.firstShow
- Visible
Yes
- Timer Name
blinkOff- Repeat Every (s)
@self.showSeconds- First Delay (s)
@self.showSeconds- Ring Once
Yes
- Visible
No
- Timer Name
blinkOn
- Visible
No
9.4.5 Blink Warning
Blink Warning is the order to blink. When fortressWarning comes, it plays the Warning Siren and switches Blink on with Set Logic State, as Mission Failed switched on Fly Again in Chapter 4. Its warningOver timer rings once, 3.4 seconds later, and switches Blink off again. Off, Blink hides the banner. That’s the end of the warning.
Its one SHARED VARIABLE is warningSeconds, a Constant, and Control Sound’s Sound list gives you the Warning Siren. Set Logic State’s Logic Component is a list, as in Chapter 4, so pick Blink in both. Its State list holds Enable, Disable and Toggle. It starts on Enable, the one the first needs. For the second, pick Disable.
When the Sky Fortress is coming, the WARNING banner blinks (its Blink Logic) for warningSeconds with the Warning Siren.
Any Object- Sound
"Warning Siren"
- Logic Component
"Blink"
- Timer Name
warningOver- Repeat Every (s)
@self.warningSeconds- First Delay (s)
@self.warningSeconds- Ring Once
Yes
- Logic Component
"Blink"- State
Disable
9.5 The Sky Fortress Comes Down
Now the giant itself.
9.5.1 Enemy Stats
The Sky Fortress carries Enemy Stats, like every enemy, with two more fields. The first, mark, is where its meter’s next mark is. The second, hitsTaken, keeps the meter itself, the hits it has taken so far.
Press Add Field twice, and type the card’s names over localVariable.
What every enemy carries; each enemy takes the values from its own row of Enemy Types. damage, mark and hitsTaken are working values every enemy starts from here (1, 0 and 0): the hits the next hit counts (Takes Hits), the damage at which the Sky Fortress next changes (Sky Fortress Battle) and the hits it has taken.
9.5.2 Enemy Types
Enemy Types gets a row for the Sky Fortress. Its health is 420, against a Heavy Bomber’s 36, and bringing it down is worth 25000 points. Its dropChance is 0. It leaves nothing behind but a won mission.
Enemy Types takes the two new columns by itself, every cell at 0, and 0 is what the card gives every plane. Then Add Row, and name the new row Sky Fortress, exactly as the Object will be named. The Sky Fortress’s Data Structure finds its row by that name. The new row starts at Enemy Stats’ defaults, so type its speed, health and points, and switch bigExplosion On.
5.93752100No71004.68755300No221004.3756350No181001.71875362000Yes1001003.437542025000Yes01009.5.3 Sky Fortress Shadow
The Sky Fortress casts a shadow on the clouds, like every plane. Its shadow is a copy of the Heavy Bomber’s, from Chapter 7, made much bigger.
Duplicate the Heavy Bomber Shadow, and name the copy Sky Fortress Shadow. It keeps its Tag, Plane Shadow, and Shadow on Clouds with its Data. Pick Sky Fortress Shadow Art in its Sprite box. The rest is size, and a Draw Order one lower than the bomber shadow’s. It’s as big as the giant itself. Its card gives the numbers.
X 12, Y 12-14Sky Fortress Shadow ArtX 12, Y 12SensorX 12, Y 12Collide Only WithTagged CloudPlane ShadowShadow on CloudsShadow on Clouds Data9.5.4 Fortress Shell
The Sky Fortress fires its own kind of round, the Fortress Shell, a small pink ball. It’s a copy of the Enemy Round from Chapter 4. It keeps its Tag, Enemy Fire, and its Logic, so it breaks on the Fighter, breaks on a bomb and leaves the view the same way.
Duplicate the Enemy Round, name it Fortress Shell, pick Fortress Shell Art, and type its Collider’s Size, a little bigger.
X 3, Y 345Fortress Shell ArtX 3, Y 3SensorX 0.438, Y 0.438Collide Only WithFighterEnemy Fire9.5.5 Patrol
Once the Sky Fortress is in place, it doesn’t sit still. It drifts to one side, slows, drifts back, and bobs a little up and down as it goes. It’s a slow, heavy sway.
That’s Weave’s idea from Chapter 7, on two axes. The sideways speed follows cos, the wave that swings between plus one and minus one. The up and down speed follows sin, the same wave a quarter turn later. Each has its own rate and its own top speed.
Patrol keeps its own clock, secondsPatrolled. Every Step adds the step’s length, $deltaTime, to it, as Weave does in Chapter 7. The clock runs only while Patrol is on. So the sway starts from its beginning when the Sky Fortress is in place, drifting to the right, not up or down.
Its four numbers never change, so they’re its SHARED VARIABLES, all Constants. The clock changes as it flies, so it lives in a Data Structure of the Logic’s own, as Weave’s two did. Press the + on the Data Structures card and choose New Data Structure. Myth names it Patrol Data. Give it one field, secondsPatrolled, a Number at 0. Then pick Plus in Change Component Value’s Operator list.
Set Velocity has both boxes this time, because Patrol does all the moving while it’s on. Fly Down set the giant’s speed only once, when it appeared, so the two never fight.
While on, drifts side to side and up and down in a slow wave around where it started patrolling.
Any Objectself.patrolData- Component Value
self.patrolData.secondsPatrolled- Operator
+=- Value
$deltaTime
- X Velocity
cos(@self.sideRate * self.patrolData.secondsPatrolled) * @self.sideSpeed- Y Velocity
sin(@self.bobRate * self.patrolData.secondsPatrolled) * @self.bobSpeed
9.5.6 Fortress Guns
Fortress Guns fires the first half of the fight. A slow fan of shells sprays from the nose, around straight down. Between the fans, the two wing guns each fire one shell at the Fighter, on a quicker beat.
You’ve built every piece of this before. The fan is Fire a Spread, from Chapter 7, with direction 270, straight down. The aim is Aim Down at the Fighter, from Chapter 4. A wing gun is Fire a Spread with a count of 1 and an arc of 0, so the one shell flies straight at its aim. The two wings differ only in a minus: one fires from -@self.wingX, the other from @self.wingX.
The guns start with On Enable, when Sky Fortress Battle switches them on. Each timer then repeats on its own. Each time one rings, it asks whether the mission is still being played, and stops its timer once it isn’t. On Disable stops both timers, when the guns are switched off.
Make its SHARED VARIABLES first, all Constants. shell and fighter are Objects, and their Starting Value stays at None. The Sky Fortress picks them. Then come the fourteen numbers, and the Timer Names take fanGun and aimedGuns bare.
Each If is one box, and its Else comes from Add Else, as in Chapter 7. In each call, caller starts on self. Pick @self.shell in round’s list, and @self.fighter in the aim’s fighter list. Type the rest. Name the aim’s call wingAim, in its Action Name box.
While on, the Sky Fortress fires Phase 1: a fan of shells from its nose and aimed shells from its two wing guns.
Any Object- Timer Name
fanGun- Repeat Every (s)
@self.fanGap- First Delay (s)
@self.fanFirst
- Timer Name
aimedGuns- Repeat Every (s)
@self.wingGap- First Delay (s)
@self.wingFirst
- Action Name
stillPlayingForFan- Game State
Playing
stillPlayingForFan.value == true- caller
self- round
@self.shell- count
@self.fanCount- direction
270- arc
@self.fanArc- speed
@self.fanSpeed- muzzleX
0- muzzleY
@self.noseY
- Particles
"Enemy Muzzle Flash"- Y
@self.noseY- Count
@self.enemyMuzzleFlashCount- Z Index Offset
2
- Sound
"Enemy Guns"
- Timer Name
fanGun
- Action Name
stillPlayingForWingGuns- Game State
Playing
stillPlayingForWingGuns.value == true- Action Name
wingAim- caller
self- fighter
@self.fighter- aimMin
@self.aimMin- aimMax
@self.aimMax
- caller
self- round
@self.shell- count
1- direction
wingAim.value- arc
0- speed
@self.wingSpeed- muzzleX
-@self.wingX- muzzleY
@self.wingY
- Particles
"Enemy Muzzle Flash"- X
-@self.wingX- Y
@self.wingY- Count
@self.enemyMuzzleFlashCount- Z Index Offset
2
- caller
self- round
@self.shell- count
1- direction
wingAim.value- arc
0- speed
@self.wingSpeed- muzzleX
@self.wingX- muzzleY
@self.wingY
- Particles
"Enemy Muzzle Flash"- X
@self.wingX- Y
@self.wingY- Count
@self.enemyMuzzleFlashCount- Z Index Offset
2
- Sound
"Enemy Guns"
- Timer Name
aimedGuns
- Timer Name
fanGun
- Timer Name
aimedGuns
9.5.7 Sky Fortress Battle
Sky Fortress Battle gives the orders. This part builds its first three Events. The fourth, the meter’s Event, comes later in the chapter, with its two Modes.
When the Sky Fortress appears, its meter’s first mark goes at half its health. Change Component Value sets mark to self.enemyStats.health / 2.
Next it works out how long the Sky Fortress takes to come down to fightY, 25.625 meters: its height above fightY, divided by its speed. That’s secondsToPosition. The inPosition timer rings once, that many seconds later.
It’s the same sum as Drift Down’s, in Chapter 8, and the If does the same job too. A sum below zero becomes 0, so a Sky Fortress already below fightY doesn’t wait. Last, it sends fortressArrived, for the health bar.
When inPosition rings, the Sky Fortress is in place. Three Set Logic States switch on Takes Hits, Patrol and Fortress Guns. From that moment on, it can be hurt, it sways from side to side, and it fires. Until then, your rounds break on it and do nothing. That’s the untouchable descent.
The third Event, On Hit Counted, passes the news along. Takes Hits will send hitCounted on this Object each time it has counted a hit. Sky Fortress Battle answers with fortressDamaged, for everyone, and the health bar listens. Nothing sends hitCounted yet. Add it with Add Custom Event….
Make all its Variables now, the ones for later too. It reads the Sky Fortress’s Enemy Stats, so press the + on its Data Structures card, and pick Enemy Stats under Existing Data Structures. Then come its five SHARED VARIABLES, all Constants. First is fightY. Next, enragedWords is a Text, the banner’s words, so type THE FORTRESS IS ENRAGED! into its Starting Value, bare. Last come the three numbers for the show.
secondsToPosition is made by When Created itself, in its first step, a Declare Variable. It’s a Number, and its Value box starts empty, so type the card’s 0.
The card’s last two When Created steps have no indent, so they belong on the main line, after the If. Add each from the Action List, and join it with Connect to sequence. It goes under the If, above End.
The three Set Logic States go one after another. Their Logic Component is a list, so pick Takes Hits, Patrol and Fortress Guns, one in each. State stays on Enable.
Brings the Sky Fortress into the fight: Fighter rounds cannot hurt it while it comes down; once at fightY it patrols, can be hurt and fires. While the mission is being played, at half health it is enraged; with no health left it stops fighting and sends fortressDown.
Any Objectself.enemyStats- Name
secondsToPosition- Value
0
- Component Value
self.enemyStats.mark- Value
self.enemyStats.health / 2
- Variable
secondsToPosition- Value
(self.transform.position.y - @self.fightY) / self.enemyStats.speed
secondsToPosition < 0- Variable
secondsToPosition- Value
0
- Timer Name
inPosition- First Delay (s)
secondsToPosition- Ring Once
Yes
- Custom Event
fortressArrived
- Logic Component
"Takes Hits"
- Logic Component
"Patrol"
- Logic Component
"Fortress Guns"
- Custom Event
fortressDamaged
9.5.8 Sky Fortress
Now the giant. The Sky Fortress is a 2D Object, so its Collider is there already. Turn its Physics Object switch off, as for the planes, so nothing can shove it. Attach a Sprite with Sky Fortress Art, 12 meters by 12. Its Draw Order is 18.
It isn’t a copy of a plane, and it wears no Tag. A copy would bring Shot Down along, and go down in one burst the moment its meter reached its first mark. So it stands alone, built whole, with its own Logic. The rounds, the Fighter and Breaks on Hit will know it by its own name, Sky Fortress.
Its Collider’s box is a little smaller than its picture, and only the Fighter’s rounds and the Fighter itself may touch it. So pick Collide Only With under Tags and Interactions, and add Tagged Fighter Round and the Fighter.
Attach a Data Structure, Enemy Stats, from Data, with Input Source Data Table and the Enemy Types table, as on the Zero Fighter in Chapter 3. It fills from the row named Sky Fortress.
Now its Logic. Fly Down brings it down, at the speed in its row. Takes Hits, from Chapter 3, goes on switched off. Under Shared Variables it gets a shorter flash, 0.05 seconds, and 18 hits for a bomb.
Its meter is Meter with Thresholds. Under Shared Variables, changeAmount, maximum and threshold are Expressions, as on the planes. Pick Expression in each Kind list, and type the card’s line into the box, quotes and all. The threshold’s reads mark.
That meter has one more Variable to fill this time. In Chapter 3 you left meterField empty, because a plane keeps its count to itself. The Sky Fortress doesn’t. Its meterField is a Text, so type hitsTaken into its Value, bare. Now the meter keeps its count in the hitsTaken field, where the health bar can read it.
Attach Sky Fortress Battle, and after it Patrol and Fortress Guns, each switched off. Under Shared Variables, pick Fortress Shell in shell’s list and Fighter in fighter’s. Last comes Cast Shadow, with its shadow and offsets.
Sinks When Shot Down, Enraged Fortress Guns and Calls Escorts come later in this chapter. Attach each when you make it. They’ll sit below Cast Shadow, not in the card’s order. That’s fine here. None of them needs another to go first.
X 12, Y 12Off18Sky Fortress ArtX 12, Y 12X 10.625, Y 7.188Collide Only WithTagged Fighter Round, FighterEnemy StatsData TableEnemy Types0.0518ExpressionobjectComponentProperty("self","dataStruct","damage")ExpressionobjectComponentProperty("self","dataStruct","health")ExpressionobjectComponentProperty("self","dataStruct","mark")hitsTakenSky Fortress Shadow1.406-2.156Fortress ShellFighterZero Fighter9.5.9 Mission Timeline
The Mission Timeline gets one more row: Boss, the Sky Fortress, last of all. It comes a few seconds after the warning, at the top middle of the window, a little higher than the planes, since it’s bigger.
This time the new row is the file’s last row. So you can keep your table.
Download the new file from the card’s File line, the green one ending in ch09, and import it. The struck one is Chapter 8’s. Myth counts 1 new row. It lands at the end, where it belongs.
3VZero Fighter11.2552.2535.93756.5ColumnZero Fighter5.312542.812535.93756.5ColumnZero Fighter17.187542.812535.9375Now borrow the first V once more. In the first row, pick Sky Fortress in the object cell, and type 1 in its count. The last part of this chapter imports the file again, and that puts the row back.
Save, and run the game. At three seconds, the gray giant slides down from the top. It stops, and starts to sway. The rest of the mission still comes at its times, so the next planes of Wave 1 fly in around it.
A fan of pink shells sprays from its nose, and the wing guns fire at you. For now, your rounds fly straight through it. The next part makes them count.
9.6 Hits That Count
Now your rounds can hurt the giant, and it can hurt you back.
9.6.1 Breaks on Hit
Breaks on Hit breaks a round on any enemy plane. The Sky Fortress isn’t one, so it gets an Event of its own: When Starting to Hit Sky Fortress. It does the same three things, roundHit to the Sky Fortress, a spark, and the round removes itself.
Add a Collision Enter Event, and pick Sky Fortress in its Collision Target. Myth renames it. The first block’s Applies To is Other, under Event Context, as in the first Event.
A round that hits an enemy tells it (roundHit) and breaks with a small spark.
Any Object- Applies To
other- Custom Event
roundHit
- Particles
"Hit Sparks"- Count
@self.hitSparksCount- Z Index Offset
2
- Applies To
other- Custom Event
roundHit
- Particles
"Hit Sparks"- Count
@self.hitSparksCount- Z Index Offset
2
9.6.2 The Three Rounds
Each of the Fighter’s rounds needs the Sky Fortress on its list too. Open the MG Round, the Spread Round and the Rapid Round, one by one, and add the Sky Fortress to Collide Only With, beside Tagged Enemy Aircraft. Each round’s Collider has its own list.
X 3, Y 335MG Round ArtX 3, Y 3SensorX 0.25, Y 0.75Collide Only WithTagged Enemy Aircraft, Sky FortressTagged Enemy AircraftFighter RoundX 3, Y 335Spread Round ArtX 3, Y 3SensorX 0.375, Y 0.375Collide Only WithTagged Enemy Aircraft, Sky FortressTagged Enemy AircraftFighter RoundX 3, Y 335Rapid Round ArtX 3, Y 3SensorX 0.313, Y 0.813Collide Only WithTagged Enemy Aircraft, Sky FortressTagged Enemy AircraftFighter Round9.6.3 Takes Hits
Takes Hits counts hits on every plane, and now on the Sky Fortress too. It gets one more step in each of its counting Events: right after changeMeter, Trigger Custom Event on Object sends hitCounted. It comes after. So the meter has already counted the hit when anyone hears of it.
Add each new block at the end of its Event’s line, and join it. A plane ignores hitCounted, because nothing on it listens. Only the Sky Fortress has Logic that does, its Sky Fortress Battle.
Each Fighter round that hits counts roundDamage on the enemy's meter and flashes it white for a moment; a bomb counts bombDamage.
Any Objectself.enemyStats- Property
Mode- Value
"solid"
- Property
Enabled- Value
true
- Timer Name
hitFlash- Repeat Every (s)
@self.flashSeconds- First Delay (s)
@self.flashSeconds- Ring Once
Yes
- Component Value
self.enemyStats.damage- Value
@self.roundDamage
- Custom Event
changeMeter
- Custom Event
hitCounted
- Property
Enabled- Value
false
- Component Value
self.enemyStats.damage- Value
@self.bombDamage
- Custom Event
changeMeter
- Custom Event
hitCounted
The card’s other changes are for the fall. They come in the part called Going down.
9.6.4 Show With Fortress
The health bar shows only while the Sky Fortress is in the sky. Show With Fortress shows its piece when fortressArrived comes, and hides it when fortressSunk comes. Nothing sends fortressSunk yet. Add it with Add Custom Event…, as for any message no one sends yet.
It has no Variables at all. Each Set Visible’s Visible is a list that starts on No, so pick Yes in the first, and leave the second.
Shows this health bar piece while the Sky Fortress is in the sky.
Any Object- Visible
Yes
- Visible
No
9.6.5 Fortress Health Fill
The bar’s fill is as wide as the Sky Fortress’s health left. Unhurt, it’s full. With half its health gone, it’s half as wide.
So when fortressDamaged comes, Fortress Health Fill works out how much is left as fill: one, take away the hits taken divided by the health. Then Set Scale makes the bar that wide, in Horizontal Scale. Vertical Scale stays 1, as it starts, so the bar keeps its height.
How does it know the hits? The message came from the Sky Fortress. In a formula, event() reads a value of the Object that sent it: event("hitsTaken") is the Sky Fortress’s hitsTaken, and event("health") its health. It’s the Event’s other, from Chapter 8, read in a formula.
It needs no Shared Variables. fill is made by the Event itself, a Declare Variable, a Number at 0, as secondsToPosition was. Type fill into Set Scale’s Horizontal Scale.
Keeps the health bar's fill as wide as the Sky Fortress's health left.
Any Object- Name
fill- Value
0
- Variable
fill- Value
1 - event("hitsTaken") / event("health")
- Horizontal Scale
fill
9.6.6 The Health Bar
The health bar is three pieces at the top of the window: a dark frame, a red fill inside it, and the words SKY FORTRESS above them. All three are on the screen, with Window / UI and Top Center, and each has Show With Fortress.
The frame is the Boss Bar Frame Art, 560 by 44 pixels. The fill is the Boss Bar Fill Art, 528 by 14, with Fortress Health Fill as well. Its picture is drawn from its left end, so it shrinks toward the left, like the Rapid Meter.
There’s nothing to set for that. The Boss Bar Fill Art comes from the Starter Kit that way.
The name is a Text / UI, in Bebas Neue, a pale pink.
Window / UITop CenterUIX 128, Y 128104Boss Bar Frame ArtX 560, Y 44Window / UITop CenterUIX 128, Y 128105Boss Bar Fill ArtX 528, Y 14Window / UITop CenterUIX 128, Y 48SKY FORTRESSBebas Neue18#FFD6C81CenterWrap to Width300Place the three from PLACE THESE, hidden. The fill’s X is -264, half its width to the left of the middle, so the fill sits centered in the frame. The name gets its Z-Index of 106.
9.6.7 Hurt by Enemies
The Fighter shouldn’t fly through the giant either. Hurt by Enemies gets a third Collision Enter Event, with Sky Fortress in its Collision Target, and it calls Hurt the Fighter, like the other two.
An enemy round or an enemy plane (the Sky Fortress too) that touches the Fighter hurts it (Hurt the Fighter); it starts every mission protected.
Any Object- caller
self- seconds
@self.startProtectSeconds
- caller
self
- caller
self
- caller
self
9.6.8 Fighter
The Fighter’s Collide Only With gets the Sky Fortress too, after Tagged Pickup. On its Changes card, that line shows twice, the new one green, the old one struck under it. The last green line, Stops When the Mission Is Won, comes in the part called Mission complete.
X 3, Y 3Off30Fighter ArtX 3, Y 3X 0, Y -0.094X 0.656, Y 0.75Collide Only WithTagged Enemy Aircraft, Tagged Enemy Fire, Tagged Pickup, Sky FortressTagged Enemy Aircraft, Tagged Enemy Fire, Tagged Pickup10.3131.31321.1887.18830Fighter Shadow0.844-1.313MG RoundSpread RoundRapid RoundSave, and run the game. The giant comes down, and the bar appears at the top, full. At first your rounds break on the Sky Fortress in sparks, and nothing more. Once it starts to sway, each hit flashes it white, and the red fill grows shorter, a little at a time. Fly into it, and it costs a medkit.
Its health is 420 hits, so the bar takes a long while to empty. Nothing happens at half yet, or when the bar is empty. That’s the next two parts. It’s a good place to stop for a break, if you’d like one.
9.7 Enraged
Now the giant gets angry.
9.7.2 Enraged Fortress Guns
Enraged Fortress Guns fires the second half of the fight. It has two guns.
The first fires a ring of 16 shells every 1.5 seconds, 22.5 degrees apart, all the way around. Each ring is turned 17 degrees further than the last, so the gaps never sit in the same place. ringAngle keeps the turn.
Here’s a small puzzle in Fire a Spread’s numbers. A fan’s arc runs from its first round to its last, not around to the first again. Between sixteen shells, 22.5 degrees apart, there are only fifteen gaps, so the arc is @self.ringStep * (@self.ringCount - 1). The sixteenth gap closes the circle.
Fire a Spread aims the middle of its fan along its direction. So the direction is ringAngle plus half the arc, and the first shell flies at ringAngle itself.
The second gun fires 3 shells from the nose every 0.7 seconds, 16 degrees across, aimed at the Fighter. That’s Aim Down at the Fighter again, named burstAim.
Build it like Fortress Guns: shell and fighter at None, then fourteen numbers, all Constants. Its ringAngle changes with every ring, so it lives in a Data Structure of the Logic’s own, as secondsPatrolled does. Press the + on Data Structures and choose New Data Structure, and Myth names it Enraged Fortress Guns Data. Give it one field, ringAngle, a Number at 0.
While on (once the Sky Fortress is enraged), it fires Phase 2: turning rings of shells and aimed triples from its nose.
Any Objectself.enragedFortressGunsData- Timer Name
ringGun- Repeat Every (s)
@self.ringGap- First Delay (s)
@self.ringGap
- Timer Name
burstGun- Repeat Every (s)
@self.burstGap- First Delay (s)
@self.burstGap
- Action Name
stillPlayingForRing- Game State
Playing
stillPlayingForRing.value == true- Component Value
self.enragedFortressGunsData.ringAngle- Operator
+=- Value
@self.ringTurn
- caller
self- round
@self.shell- count
@self.ringCount- direction
self.enragedFortressGunsData.ringAngle + @self.ringStep * (@self.ringCount - 1) / 2- arc
@self.ringStep * (@self.ringCount - 1)- speed
@self.ringSpeed- muzzleX
0- muzzleY
@self.ringY
- Particles
"Enemy Muzzle Flash"- Y
@self.ringY- Count
@self.enemyMuzzleFlashCount- Z Index Offset
2
- Sound
"Enemy Guns"
- Timer Name
ringGun
- Action Name
stillPlayingForBurst- Game State
Playing
stillPlayingForBurst.value == true- Action Name
burstAim- caller
self- fighter
@self.fighter- aimMin
@self.aimMin- aimMax
@self.aimMax
- caller
self- round
@self.shell- count
@self.burstCount- direction
burstAim.value- arc
@self.burstArc- speed
@self.burstSpeed- muzzleX
0- muzzleY
@self.noseY
- Particles
"Enemy Muzzle Flash"- Y
@self.noseY- Count
@self.enemyMuzzleFlashCount- Z Index Offset
2
- Sound
"Enemy Guns"
- Timer Name
burstGun
- Timer Name
ringGun
- Timer Name
burstGun
9.7.3 Calls Escorts
Once it’s enraged, the giant calls for help. Two Zero Fighters come down from above the top, one on each side, and two more every 6 seconds. They’re escorts, plain Zero Fighters that fly, fire and go down like any other.
Calls Escorts starts its escorts timer when fortressEnraged comes, first after 2 seconds. Each time it rings, while the mission is being played, two Create Instances make a Zero Fighter at leftX and at rightX. Once the mission is over, the Else stops the timer.
Its escort is an Object Shared Variable, a Constant, and its Starting Value stays at None. The Sky Fortress picks Zero Fighter. Each Create Instance picks @self.escort in Object to Create, among the Logic’s own Object Variables. Myth names the second one created2 by itself, in its Created As box, since the first is already created.
The card gives no Position Relative To, so leave it on World, as it starts. The card’s leftX and rightX are places in the sky, at the window’s two sides, not places on the giant.
Once the Sky Fortress is enraged, two Zero Fighter escorts arrive above the top every escortGap seconds.
Any Object- Timer Name
escorts- Repeat Every (s)
@self.escortGap- First Delay (s)
@self.escortFirst
- Action Name
stillPlaying- Game State
Playing
stillPlaying.value == true- Object to Create
@self.escort- X
@self.leftX- Y
@self.entryY
- Object to Create
@self.escort- X
@self.rightX- Y
@self.entryY- Created As
created2
- Timer Name
escorts
9.7.4 Sky Fortress Battle: Enraged
Now Sky Fortress Battle’s fourth Event, On Meter Threshold Reached. Add it, and leave Any meter, as for Shot Down’s in Chapter 3.
It runs twice in a fight. The first time, at half health, the Sky Fortress is enraged. The second, at full, it goes down.
So the Event gets two Modes. Right-click its Mode 1, choose Rename Mode…, and name it Enraged. Then add Go Down with New Mode…. Its Modes stay on One at a time, and Enraged is the Starting Mode, as the card’s (Starting Mode) says. Go Down’s blocks come in the next part.
The Enraged Mode starts with the same question as the rest: is the mission still being played? Rounds still in the air after the Fighter is lost mustn’t enrage it. Then it moves the mark. Its meter’s mark was half its health. Now it’s all of it, so the next time the meter reaches mark, the Sky Fortress has nothing left.
After that, Switch Mode turns this Event to Go Down, so the second time runs that instead. The card has no Event line, so its Event list stays on Current Event. Its Mode list then holds this Event’s own two. Pick Go Down.
Then comes the show. The words go into $banner, from @self.enragedWords, the camera shakes, and a Big Explosion bursts with the Explosion Large. Last come the new orders. Fortress Guns goes off, with Disable in its State list, Enraged Fortress Guns goes on, and fortressEnraged goes out to the banner and the escorts.
- Action Name
stillPlayingForEnrage- Game State
Playing
stillPlayingForEnrage.value == true- Component Value
self.enemyStats.mark- Value
self.enemyStats.health
- Mode
Go Down
- Variable
$banner- Value
@self.enragedWords
- Intensity
@self.enrageShakeStrength- Seconds
@self.enrageShakeSeconds
- Sound
"Explosion Large"
- Particles
"Big Explosion"- Count
@self.enrageBigExplosionCount- Z Index Offset
2
- Logic Component
"Fortress Guns"- State
Disable
- Logic Component
"Enraged Fortress Guns"
- Custom Event
fortressEnraged
Attach Enraged Fortress Guns to the Sky Fortress, switched off. Its shell and fighter are picked already. They’re the same two Shared Variables Fortress Guns brought, so Myth Engine keeps your picks. Calls Escorts goes on too, switched on, since it does nothing until fortressEnraged comes. Under Shared Variables, pick Zero Fighter in escort’s list.
Halfway through 420 hits takes a while. For a quicker test, open Enemy Types and type 36 in the Sky Fortress’s health, the Heavy Bomber’s. Half of that is 18, a bomb’s worth.
Save, and run the game. When the giant has started to sway, press B. The camera shakes, a Big Explosion bursts, and THE FORTRESS IS ENRAGED! crosses the screen.
The fans stop. Rings of pink shells spin out instead, with triples from the nose. Two Zero Fighters come down at the sides, and two more after them.
Keep the 36 for now. The next two parts use it too.
9.8 Going Down
Now it falls.
9.8.1 Breaks on Bomb
When the Sky Fortress goes down, it clears the sky, as a bomb does. Breaks on Bomb gets a second Event, for fortressDown, with the same two blocks. Every enemy round in the sky breaks.
Go Down will send fortressDown, at the end of this part. Nothing sends it yet, so add it with Add Custom Event…. From then on it’s in the Add Event list, so the next two pieces pick it there.
An enemy round breaks with a small spark when a bomb goes off or the Sky Fortress goes down.
Any Object- Particles
"Hit Sparks"- Count
@self.blastSparksCount- Z Index Offset
2
- Particles
"Hit Sparks"- Count
@self.blastSparksCount- Z Index Offset
2
9.8.2 Takes Hits: The Fall
Every enemy plane hears fortressDown too. Takes Hits counts it as a bomb: bombDamage hits, so the escorts go down with their giant.
It also gets On Disable. Go Down switches Takes Hits off on the Sky Fortress. If the last hit’s white flash were still on, it would sink white. So On Disable switches the tint off at once, and it sinks in its own colors.
- Component Value
self.enemyStats.damage- Value
@self.bombDamage
- Custom Event
changeMeter
- Custom Event
hitCounted
- Property
Enabled- Value
false
9.8.3 Sinks When Shot Down
The Sky Fortress doesn’t burst like a plane. It sinks, slowly, for 2.6 seconds, with small explosions bursting all over its back and wings. At the end it goes in one huge one.
When fortressDown comes, it starts sinking at sinkSpeed, with a long, gentle shake and the Explosion Large. Two timers start. The sinkBlast timer rings every 0.16 seconds, from the start, over and over. The sunk timer rings once.
Each sinkBlast picks a place on the giant at random. The blastX roll is a number from -@self.blastWidth to @self.blastWidth, and blastY one from -@self.blastHeight to @self.blastHeight. A Plane Explosion bursts there, with the Explosion Small. That’s a chain of small fires, all over its back.
When sunk rings, the chain stops. Everything else comes at once: one great explosion, smoke, the Explosion Boss, a cream-white flash and a heavier shake. The message fortressSunk tells the health bar and Game Rules. Last of all, it removes itself.
Its thirteen SHARED VARIABLES are all Constants. Type blastX and blastY over each Generate Random Number’s Action Name. Camera Flash’s Color is a swatch that starts white. Click it, and type the card’s cream, fff4d6, into its HEX box.
When the Sky Fortress is shot down it sinks slowly with small explosions, then bursts, sends fortressSunk and is removed.
Any Object- X Velocity
0- Y Velocity
-@self.sinkSpeed
- Intensity
@self.goDownShakeStrength- Seconds
@self.goDownShakeSeconds
- Sound
"Explosion Large"
- Timer Name
sinkBlast- Repeat Every (s)
@self.blastGap- First Delay (s)
0
- Timer Name
sunk- Repeat Every (s)
@self.sinkSeconds- First Delay (s)
@self.sinkSeconds- Ring Once
Yes
- Action Name
blastX- Minimum
-@self.blastWidth- Maximum
@self.blastWidth
- Action Name
blastY- Minimum
-@self.blastHeight- Maximum
@self.blastHeight
- Particles
"Plane Explosion"- X
blastX.value- Y
blastY.value- Count
@self.planeExplosionCount- Z Index Offset
3
- Sound
"Explosion Small"
- Timer Name
sinkBlast
- Particles
"Big Explosion"- Count
@self.sunkBigExplosionCount- Z Index Offset
4
- Particles
"Smoke Puff"- Count
@self.smokePuffCount- Z Index Offset
2
- Sound
"Explosion Boss"
- Color
#fff4d6- Seconds
@self.sinkFlashSeconds
- Intensity
@self.sunkShakeStrength- Seconds
@self.sunkShakeSeconds
- Custom Event
fortressSunk
Attach it to the Sky Fortress.
9.8.4 Sky Fortress Battle: Go Down
Back to Sky Fortress Battle, and its Go Down Mode. It has a line of its own, beside Enraged’s, so give it its blocks there. Each Set Logic State picks its Logic and Disable.
It asks the same question first. A mission already lost can’t be won by rounds still in the air. Next, it switches the fight off. It sends enemyShotDown, so Add Points adds its 25000 points, as for any plane. Last, fortressDown, for everything listening.
- Action Name
stillPlayingForGoDown- Game State
Playing
stillPlayingForGoDown.value == true- Logic Component
"Takes Hits"- State
Disable
- Logic Component
"Patrol"- State
Disable
- Logic Component
"Enraged Fortress Guns"- State
Disable
- Logic Component
"Calls Escorts"- State
Disable
- Custom Event
enemyShotDown
- Custom Event
fortressDown
Save, and run the game. Drop a bomb on the giant when it starts to sway. Wait. After the rings begin, wait for the first two escorts, and drop the second. It shakes, its escorts burst into smoke, and every shell in the sky breaks.
The score jumps by 25000. Then it sinks slowly, with small fires all over its back, and goes in a huge cream-white flash. The health bar vanishes with it.
After that, the mission goes on. The waves still come at their times, since you borrowed only the first row, but nothing ends the mission yet. Winning it is the last part.
9.9 Mission Complete
Now the mission can be won.
9.9.1 Mission Complete
Game Rules decides when the mission is lost, in Lose a Medkit, from Chapter 4. Now it decides when it’s won, in Mission Complete. When fortressSunk comes, and the mission is still being played, Set Game State picks Mission Complete.
That’s all it does. Everything else about the win answers the Game State, the way everything about a loss already does.
Wins the mission when the Sky Fortress has sunk, if the mission is still being played.
Any Object- Action Name
stillPlaying- Game State
Playing
stillPlaying.value == true- Game State
Mission Complete
9.9.2 Stops When the Mission Is Won
When the mission is won, the Fighter stands down. It stops where it is, and it no longer flies, fires, drops bombs or can be hurt.
Stops When the Mission Is Won does it on the Fighter itself, as Lost With the Last Medkit does for a loss. It switches off the Fighter’s own Logic, one Set Logic State each, and Set Velocity stops it where it is.
It needs no Variables. Pick each Logic in its Set Logic State’s list, with Disable. Set Velocity’s two boxes start empty, so type 0 in both. Attach it to the Fighter.
When the mission is won the Fighter stops: it no longer flies, fires, drops bombs or can be hurt.
Any Object- Action Name
missionComplete- Game State
Mission Complete
missionComplete.value == true- Logic Component
"Top-down Controls"- State
Disable
- Logic Component
"Fighter Guns"- State
Disable
- Logic Component
"Hurt by Enemies"- State
Disable
- Logic Component
"Drops Bombs"- State
Disable
- X Velocity
0- Y Velocity
0
9.9.3 Mission Over
In Chapter 4, Mission Failed brought up the result screen after a loss. Now it does both endings. So it gets a name that fits both: Mission Over.
Rename it. Right-click Mission Failed in the Resources, and choose its Rename line. A box opens in its row, so type Mission Over there, and press Enter. It stays on Game Rules, in its place.
That’s what the Set up card’s REMOVED line means here: the old name goes, and the piece stays. It’s also the green line on Game Rules’ card.
Now make it match its card. Its card shows the whole piece, not its changes, because its name is new. So nothing on it is struck.
In short: two old blocks go, Start Recurring Timer and Set Logic State. Everything else of yours stays. Its Description changes too, so type the card’s over the old one.
Its new Shared Variable is victorySeconds, a Constant, 3. On Game State Changed gets a second Check Game State, missionComplete, dragged in second, and its If’s condition gets its || part, as in Mission Music and Show Banner.
Inside the If, the screen waits 2.4 seconds after a loss, and 3 after a win, a little longer to watch the giant go. Its Start Recurring Timer now sits in a new If, with an Else. So delete it. Add the new If with the outer If’s Add inside Then, and its own Add inside Then gives the True line a Start Recurring Timer. Add Else and Add inside Else give the Else line the other.
On the Result Screen Timer changes too. FLY AGAIN switches on only after a loss. Delete Set Logic State, and add three blocks at the end of the line. First comes Check Game State with Mission Failed, named endedInFailure. After it comes an If, and on its True line, Set Logic State with Fly Again picked.
When the mission ends, the result screen shows a moment later (resultSeconds after a loss, victorySeconds after a win); after a loss FLY AGAIN switches on.
Any Object- Action Name
missionFailed- Game State
Mission Failed
- Action Name
missionComplete- Game State
Mission Complete
missionFailed.value == true || missionComplete.value == truemissionFailed.value == true- Timer Name
resultScreen- First Delay (s)
@self.resultSeconds- Ring Once
Yes
- Timer Name
resultScreen- First Delay (s)
@self.victorySeconds- Ring Once
Yes
- Custom Event
showResults
- Action Name
endedInFailure- Game State
Mission Failed
endedInFailure.value == true- Logic Component
"Fly Again"
9.9.4 High Score
High Score keeps a better score after a loss. Now after a win too. Its change is the same as Mission Music’s: a second Check Game State, missionComplete, dragged in second, and the If’s condition with its || part.
Reads the high score from this device when a mission starts, and saves a better score when the mission ends.
Any Object- Action Name
savedHighScore- Key
"highScore"- Default
0
- Variable
$highScore- Value
savedHighScore.value
- Action Name
missionFailed- Game State
Mission Failed
missionFailed.value == true- Action Name
missionComplete- Game State
Mission Complete
missionFailed.value == true || missionComplete.value == true$score > $highScore- Variable
$highScore- Value
$score
- Action Name
persistentWriteResult- Key
"highScore"- Value
$highScore
9.9.5 Show With Results
The result screen of a won mission has pieces of its own: MISSION COMPLETE: THE SKY FORTRESS HAS FALLEN, and RETURN TO BASE with its Enter key. In Chapter 4 you gave every result piece a state, and said they’d come in this chapter. Here they are.
Some pieces belong to both endings, though: the veil, FINAL SCORE and HIGH SCORE. So Show With Results gets one more PER INSTANCE VARIABLE, anyEnding. A piece with anyEnding Yes shows whatever the ending.
Press the + on Per Instance Variables, and pick Boolean in the Type list. Its Starting Value becomes a list, already at No.
The If’s condition changes. Now it asks self.anyEnding == true first, and then, after the ||, what it used to ask, stateMatches.value == true.
On the card, step 2 is struck, and a green step 2 stands under it. That’s how a card draws an If whose condition changed. Set Alpha and Set Visible, steps 3 and 4, aren’t marked, so they stay as they are.
So don’t delete the If. Deleting it would take those two blocks along. Click its box instead, and type the card’s whole condition over the old one.
Shows this result screen piece when Game Rules sends showResults, if the Game State is the piece's own (or for any ending, with anyEnding Yes).
Any Object- Action Name
stateMatches- Game State
self.state
stateMatches.value == trueself.anyEnding == true || stateMatches.value == true- Alpha
self.opacity
- Visible
Yes
9.9.6 The Won Mission’s Screen
The Mission Complete Banner is a blue banner, with MISSION COMPLETE in gold and THE SKY FORTRESS HAS FALLEN under it. The Return Key is the Enter key’s picture, and the Return Prompt is the words RETURN TO BASE in pale blue. All three are on the screen, with Window / UI and Center, and each has Show With Results.
You built their twins in Chapter 4. Duplicate each one, and the copy brings Show With Results along.
A copy of the Game Over Banner needs its name and the Mission Complete Banner Art. Its size, 640 by 170, and its Draw Order, 141, are already the Game Over Banner’s, so they need nothing. A copy of the Fly Again Key needs only its name, Return Key. A copy of the Fly Again Prompt needs its name, RETURN TO BASE in its Text, and a Size X of 165. Its pale blue Color is the Fly Again Prompt’s already.
Window / UICenterUIX 128, Y 128141Mission Complete Banner ArtX 640, Y 170Window / UICenterUIX 128, Y 128142Key Enter IconX 72, Y 36Window / UICenterUIX 128, Y 48RETURN TO BASEBebas Neue28#BCD7E81CenterWrap to Width165Place the three from PLACE THESE, hidden. In Show With Results’ section of each placement’s Logic, type mission-complete into the State box, with no quotes. That’s how Myth stores the Game State Mission Complete. The Return Prompt’s Z-Index is 142.
Now for CHANGE THESE PLACEMENTS. Select the Result Veil, Final Score and Result High Score in the Scene, one by one. In the same section, each has an Any Ending switch now, reading No. Switch it on, so it reads Yes.
The veil’s line gives its Opacity too, the 0.6 you typed in Chapter 4. It doesn’t change.
The Game Over Banner and the FLY AGAIN pieces keep anyEnding off. They belong to a lost mission only.
9.9.7 Game Rules
Here’s Game Rules now. Mission Over is where Mission Failed was, and Mission Complete is new, at the bottom.
X 3, Y 3Run Mission TimelineRun Mission Timeline DataSave, and run the game, with the borrowed row and the test health still in.
Bring the giant down with your two bombs. It sinks and goes in its cream-white flash, and the Boss Theme gives way to the Victory Jingle. The Fighter stops where it is. Space does nothing. Three seconds later, the screen darkens, and the blue banner says MISSION COMPLETE: THE SKY FORTRESS HAS FALLEN, over your final score and the high score.
RETURN TO BASE waits under it, with its Enter key. Press Enter, and nothing happens yet. In Chapter 10 it takes you back to the Main Menu.
9.10 The Whole Mission
Now put the mission back.
Open Enemy Types, and type 420 in the Sky Fortress’s health again. Then import the Mission Timeline’s file once more, and Myth puts the first row back as the file has it, five Zero Fighters in a V.
Save, and run the game. Fly the whole mission. Four waves, then the warning, and the Sky Fortress. It’s the longest fight in the game, so take your time.
Watch for each of these.
- At 112 seconds of mission time, STAGE says BOSS. No wave banner comes. WARNING blinks instead, with the siren, and the Boss Theme replaces the Battle Theme.
- A few seconds later, the gray giant comes down the middle, and the SKY FORTRESS bar appears at the top, full.
- While it comes down, your rounds break on it in sparks, and the bar doesn’t move.
- Once it stops and sways, each hit flashes it white, and the red fill shortens. A bomb takes a bigger bite.
- It fires fans of 7 pink shells from its nose, and single shells from each wing at you.
- Fly into it, and it costs a medkit, as any enemy plane would.
- At half, the camera shakes. THE FORTRESS IS ENRAGED! crosses the screen. Rings of 16 shells spin out, turning a little each time, with triples from the nose.
- Two Zero Fighter escorts come down at the sides, then two more every 6 seconds.
- When the bar is empty, every shell in the sky breaks, the escorts go down, and the score jumps by 25000. The giant sinks in a chain of small explosions, and goes in a cream-white flash.
- The Victory Jingle plays, the Fighter stops, and 3 seconds later the screen says MISSION COMPLETE: THE SKY FORTRESS HAS FALLEN, with RETURN TO BASE.
- Lose instead, and it’s GAME OVER, as before, with FLY AGAIN.
The Sky Fortress arrives with all its Logic, most of it switched off. It comes down untouchable. In place, it switches on its patrol, its guns and its hits. At half, one Mode swaps its guns and calls its escorts, and turns the Event to its other Mode. At full, the other switches everything off and sinks it.
The meter only counts. Sky Fortress Battle gives the orders.
Underneath is one idea, which you met in Chapter 4 with Fly Again: a Logic Component that’s off answers nothing. Switching pieces on and off, at the right moments, gives one Object a fight with a beginning, a middle and an end. No piece checks which part of the fight it’s in. Each one does its job while it’s on, and waits while it’s off.
9.11 If It Didn’t Work
Something may be a little off the first time. That’s normal. This is a long chapter with many orders, so run the game, find the piece that misbehaves, and watch what it does.
No WARNING, and no siren? Look at the Waves table: the Boss row’s warning switch should be On. Then in Run Waves, the new If’s condition is data("Waves", self.runWavesData.nextWave, "warning") == true, on the outer If’s True line, right after the banner’s Change Variable. Last, Blink Warning should be on the Warning Banner, with fortressWarning spelled the same in both.
The WARNING shows but never blinks, or never goes? Blink’s switch on the Warning Banner should be gray, off, at the start. Blink Warning’s first Set Logic State says Enable, and its second says Disable.
The music never turns? Look for On Fortress Warning in Mission Music.
Each wave comes, but with no banner at all? Perhaps the old Trigger Custom Event went, but the new one never came back. Its Else should send waveStarted.
The Sky Fortress never comes? Is the Boss row in the Mission Timeline, with Sky Fortress in its object cell? If the cell says missing, the Object didn’t exist yet when you imported. Pick Sky Fortress in it.
It comes down, but keeps going, out of the window? Look at Sky Fortress Battle’s first Event. Its Start Recurring Timer and Trigger Custom Event belong on the main line, after the If. After that, look at its second Event, which switches Patrol on.
It stops, but never fires? Fortress Guns should be attached, switched off, and the Sky Fortress’s Shared Variables should pick Fortress Shell and Fighter. Sky Fortress Battle should switch it on.
Your rounds fly through it, even once it sways? Each of the three rounds needs the Sky Fortress in its Collide Only With, and the Sky Fortress needs Tagged Fighter Round in its own. And Breaks on Hit needs its second Event, When Starting to Hit Sky Fortress.
It flashes white, but the bar never moves? Look at meterField under the Sky Fortress’s Shared Variables. It should say hitsTaken, bare. Takes Hits should send hitCounted after changeMeter, in each Event.
The bar starts empty and grows? Fortress Health Fill’s formula is 1 - event("hitsTaken") / event("health"), with the 1 first.
Half its health goes, and nothing happens? Look at threshold under the Sky Fortress’s Shared Variables, which should be an Expression that reads mark. Next, look at Sky Fortress Battle’s first Change Component Value, which sets mark to half the health.
It’s enraged again and again, and never goes down? Switch Mode in Enraged should pick Go Down, and the Event’s Modes should stay One at a time.
The bar empties, and it flies on? Go Down’s last step sends fortressDown. Sinks When Shot Down should be attached to the Sky Fortress.
It sinks white? Takes Hits’ On Disable should switch the tint off, with Enabled false.
It goes, but the mission never ends? Mission Complete should be on Game Rules, listening for fortressSunk. Sinks When Shot Down sends it, right before it removes itself.
FLY AGAIN shows after a win? In Mission Over, Set Logic State belongs inside the new If, after Check Game State asks for Mission Failed.
The veil or the scores are missing from the won screen? Their placements need Any Ending switched on.
The giant goes down in a few hits? Enemy Types’ Sky Fortress row should say 420 again, not the test’s 36.
The game won’t start? Myth says Can’t run yet, and its message names the Logic Component that’s wrong. Open it, and the Errors bar under the canvas says which block. Count the quotes.
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.
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 chapter’s project stays as it was. Or start Chapter 10 from this chapter’s catch-up download.
Now give the giant a third way to fight. Move its first mark to a third of its health, and the second to two thirds.
Add a third Mode, and a gun of your own to switch on there. Faster rings? A spiral? Shells aimed at where the Fighter is going?
Or make a giant of your own, with its own picture borrowed for now. What would it do when it’s angry?
Still stuck? Search the manual, or ask in the Myth Engine Discord (opens a new tab).
Your mission can be won now, and lost. In Chapter 10, Sky Ace gets its front door, a title screen with a menu.
