- Learn
- Build a Game
- Sky Ace
- 8 Pickups, Weapons and Bombs
8 Pickups, Weapons and Bombs
Shot-down planes leave things behind now, and supply drops arrive on time. Fly through one, and words rise to say what it gave: a higher gun level, a medkit, a bomb, or a new weapon. Spread Shot fans its rounds out, and Rapid Guns fires faster for 10 seconds. Press B, and a bomb clears every enemy round from the sky.
The game as it is at the end of this chapter. Click the game to play.
This chapter builds on Chapter 7’s game. Starting here? The catch-up download in Chapter 7’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 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. Beside it, OFL.txt is the license of the project’s font, Bebas Neue.
8.1 The Idea
A Heavy Bomber goes down, and the camera shakes. Where it fell, something is left behind: a round orange badge with a P on it. It drifts down the window, swaying a little as it goes. Fly into it. A chime, a sparkle, and POWER UP! rises from where it was.
That badge is a pickup. It drifts down, and when the Fighter flies through it, it gives something. There are five kinds. A Power Up raises the gun level, a Medkit gives a medkit, and a Bomb Crate gives a bomb.
The other two change the weapon, what the Fighter fires while you hold Space. Spread Shot throws a fan of green rounds, and Rapid Guns fires blue rounds, faster, for a while.
Some pickups come from planes you shoot down. Others are supply drops. The Mission Timeline brings them at their own times, the way it brings each formation.
The mission needs them. Four waves of planes shoot back now, and every hit costs a medkit and a gun level. Pickups give them back. And when the sky fills with rounds, there’s the bomb. Press B, and every enemy round breaks at once, and every enemy plane takes a heavy hit.
The weapon is the new idea here, so think of it as a dial on the guns. Space is still the trigger. The dial says what the trigger fires, and a pickup turns the dial.
One pickup gives its reward before you can see it. A Bomb Crate adds a bomb to your count, but the bomb icons come later, in the part called Bombs.
8.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.
- A plane is shot down -> Shot Down tells its own Logic, shotDown -> Drops a Pickup may leave a pickup where it fell.
- A supply drop’s time comes -> Make a Row Arrive makes its pickup above the window.
- The Fighter touches a pickup -> Collected by Fighter sends the pickup’s own message -> Pickup Rewards on Game Rules, or Weapon Pickups on the Fighter, gives the reward.
- A reward is given -> Show the Reward sends the words up over the pickup.
- Spread Shot or Rapid Guns is collected -> Weapon Pickups switches While Fire Is Held to that weapon’s Mode -> holding Space fires it.
- Rapid Guns’ time runs out -> the rapidGuns timer rings -> Reset Modes brings back the machine guns.
- B is pressed -> Drops Bombs sends bombDropped -> Spend a Bomb takes one away, every enemy round breaks, and every enemy plane takes bombDamage hits.
8.3 Set Up
This chapter uses eight more pictures, the five pickups, two new rounds and the bomb icon, and four sounds. They’re all in your project already, from the Starter Kit.
There’s one new Command, Bomb. It’s a Button with two keys, B and K, made in the Input Manager, as The Set up card shows. Your Logic only ever asks about Bomb, never which key it was.
Two Global Variables come with it. The first, $weaponName, is a Text, the weapon’s name for the bottom bar, starting at MACHINE GUNS. Pick Text in its Type list first. Its row still holds a 0, so type MACHINE GUNS over it. The other, $bombs, is a Number, starting at 2, the bombs the Fighter carries into a mission.
PLACE THESE lists four Objects that this chapter makes later. Place each one in the part that makes it.
B, K8.4 The Pickups
First, the pickups themselves.
All five are alike. Each drifts down slowly, sways a little from side to side, and vanishes near the bottom. Touched by the Fighter, each one sparkles, plays its sound and goes. So they share a Tag, Pickup, like the planes. They share their Logic too. You’ll build the Power Up Pickup whole, then copy it four times, and the copies differ only in their picture, their sound and the message they send.
8.4.1 Pickup Sparkle
A pickup the Fighter collects bursts into 18 sparks, white, pale yellow and gold. They fly out a little way and shrink to nothing in under a second.
Make it like the other effects, from a Blank Particle. Its Multiple Colors list starts with two rows, so press Add Color for the third.
0180.25min 250, max 600min 1.875, max 5.625FX SparkMultiple Colors#FFFFFF, #FFF3B0, #FFD24A1.5start 0.7, end 08.4.2 Weave
A pickup sways as it drifts, like a Red Ace. So it borrows Weave, from Chapter 7, with gentler numbers of its own.
There’s one difference. Each Red Ace starts at a random point of its wave, so a V of them never sways in step. Pickups don’t need that. Each one starts at the same point, and its first drift is to the right.
That random start came from the 6.28 in the Generate Random Number’s Maximum. Now the Maximum is a Shared Variable, phaseMax. It’s a new Constant Number that starts at 6.28. Make it with the + on Shared Variables, and type @self.phaseMax into the Maximum box.
The Red Ace keeps the 6.28, so nothing changes for it. Each pickup will set its phaseMax to 0, and a random number from 0 to 0 is always 0.
On the Changes card, the Maximum line shows twice: @self.phaseMax in green, and the old 6.28 struck under it. Up in Attach to, the five pickups are named. You’ll attach Weave to the first in a moment.
Weaves from side to side on the way down: the sideways speed follows a slow wave, starting at a random point of it.
Any Objectself.weaveData- Action Name
phaseRoll- Maximum
@self.phaseMax- Maximum
6.28
- Component Value
self.weaveData.weavePhase- Value
phaseRoll.value
- Component Value
self.weaveData.secondsFlown- Operator
+=- Value
$deltaTime
- X Velocity
cos(@self.weaveRate * self.weaveData.secondsFlown + self.weaveData.weavePhase) * @self.weaveSpeed
8.4.3 Drift Down
A pickup falls at fallSpeed, 2.344 meters a second, less than a quarter of the Fighter’s speed. Once it’s down to lowestY, 2.5 meters, it removes itself.
Drift Down works the way Dive Attack’s descent does in Chapter 7. When Created sets the fall. It also works out how long the pickup has until it’s down to lowestY: its height above lowestY, divided by fallSpeed. That’s secondsToLowest. One timer, sinking, rings once after that many seconds, and the pickup is gone.
A pickup that starts below lowestY would get a time under 0, so the If makes it 0, and the timer rings at once.
Its Set Velocity has only a Y Velocity, -@self.fallSpeed. The minus sends it down. X Velocity stays empty, because Weave sets the sideways speed. The two never fight over the pickup, as Fly Down and Weave never fight over a Red Ace.
Make its two SHARED VARIABLES first, both Constants. secondsToLowest 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 Timer Name takes sinking bare. Ring Once is a list: pick Yes.
The card’s last When Created step, Start Recurring Timer, has no indent. It belongs on the main line, after the If. So once the If’s own step is in, add it from the Action List, and join it with Connect to sequence. It goes under the If, above End.
Falls straight down at fallSpeed and is removed once it is below lowestY.
Any Object- Name
secondsToLowest- Value
0
- Y Velocity
-@self.fallSpeed
- Variable
secondsToLowest- Value
(self.transform.position.y - @self.lowestY) / @self.fallSpeed
secondsToLowest < 0- Variable
secondsToLowest- Value
0
- Timer Name
sinking- First Delay (s)
secondsToLowest- Ring Once
Yes
8.4.4 Collected by Fighter
The Fighter flies into a pickup. If the mission is still being played, the pickup plays its sound, bursts into sparkles, sends its message and removes itself.
Only the pickup handles the touch, the way an enemy round does with Breaks on Fighter in Chapter 4. And it doesn’t know what it gives. It only says which pickup it was, and whoever gives that reward answers.
So each pickup can set three things for itself: its collectSound, its pickupSparkleCount, and collectedEvent, the name of the message it sends. A Power Up sends powerUpCollected, and a Medkit sends medkitCollected. All five keep the 18 sparks. So their cards give only the other two.
Its three SHARED VARIABLES are Constants, and one is a new kind. The first, collectSound, is a Sound, from the Type list, and its Starting Value is then a list of your sounds. Pick Power Up Chime. The last, collectedEvent, is a Text, so type powerUpCollected into its Starting Value, bare.
Then go by the card. Trigger Custom Event’s Custom Event box takes @self.collectedEvent, with its @. So the message’s name comes from the Shared Variable, and each pickup sends its own.
Control Sound’s Sound list holds your sounds, and under them, under Shared Variables, @self.collectSound. Pick that one. Then each pickup plays its own sound, the one on its card.
The Event is a Collision Enter. Pick Fighter in its Collision Target, in its Event’s Collision section, as on Breaks on Fighter. The card’s heading, When Starting to Hit Fighter, is that same Event. Check Game State starts on Playing, the one it needs. The If is one box, stillPlaying.value == true. And "Pickup Sparkle" goes in quotes. The Particles box reads a small formula, so an effect’s name always takes them.
The message goes before Destroy Instance. A message is answered at once. So the reward is given while the pickup is still there to show it over.
When the Fighter touches this pickup while the mission is being played, it plays its sound and sparkle, sends its collectedEvent and is removed.
Any Object- Action Name
stillPlaying- Game State
Playing
stillPlaying.value == true- Sound
@self.collectSound
- Particles
"Pickup Sparkle"- Count
@self.pickupSparkleCount- Z Index Offset
2
- Custom Event
@self.collectedEvent
8.4.5 Power Up Pickup
The Power Up Pickup comes first. It’s a 2D Object, so its Collider is there already. Make it a Sensor, a box 1.25 meters across. Sensor is the middle of the Collider’s three Collision buttons, as on the Enemy Round in Chapter 4. A Sensor notices a touch but never pushes, so the Fighter flies through. Only the Fighter may touch it, so pick Collide Only With under Tags and Interactions, and add the Fighter.
Attach a Sprite with Power Pickup Art. Its Draw Order is 25, under the Fighter’s 30, so the Fighter flies over it. Then attach Tags, and give it a new Tag, Pickup, the way the planes got Enemy Aircraft in Chapter 3.
Switch to its Logic, and attach the card’s four Logic Components: Collected by Fighter, Drift Down, Weave and Remove When Out of View. Weave brings its Weave Data along, under Data Structures, by itself.
Under Shared Variables, type Weave’s three numbers. Its weaveSpeed, 1.719, is about a quarter of a Red Ace’s 6.563, and its weaveRate, 2.2, makes each sway a little slower. And phaseMax is 0, so every pickup starts its sway the same way. The Power Up keeps Collected by Fighter’s own sound and message, so its card gives neither.
X 3, Y 325Power Pickup ArtX 3, Y 3SensorX 1.25, Y 1.25Collide Only WithFighterPickupWeaveWeave Data1.7192.208.4.6 The Other Four Pickups
The other four are copies, so duplicate the Power Up Pickup four times from its right-click menu in the Resources. In each copy, type its name, pick its picture, and set its values under Shared Variables. The copy keeps its Tag, its Collider, its Logic and its Weave Data.
Each card shows the copy’s picture and its values. collectSound is a list of your sounds, and collectedEvent is a box, so type the message bare. The two weapons share one sound, so the Rapid Guns Pickup sounds like the Spread Shot, Weapon Swap. The Bomb Crate keeps the Power Up’s chime, so its card gives only its message. The Medkit has a chime of its own.
X 3, Y 325Spread Pickup ArtX 3, Y 3SensorX 1.25, Y 1.25Collide Only WithFighterPickupWeaveWeave Data1.7192.20Weapon SwapspreadShotCollectedX 3, Y 325Rapid Pickup ArtX 3, Y 3SensorX 1.25, Y 1.25Collide Only WithFighterPickupWeaveWeave Data1.7192.20Weapon SwaprapidGunsCollectedX 3, Y 325Bomb Pickup ArtX 3, Y 3SensorX 1.25, Y 1.25Collide Only WithFighterPickupWeaveWeave Data1.7192.20bombCrateCollectedX 3, Y 325Medkit Pickup ArtX 3, Y 3SensorX 1.25, Y 1.25Collide Only WithFighterPickupWeaveWeave Data1.7192.20Medkit ChimemedkitCollected8.4.7 Fighter
The Fighter has to let pickups touch it. Add Tagged Pickup to its Collide Only With list, beside Tagged Enemy Aircraft and Tagged Enemy Fire. The one Tag covers all five.
On its Changes card, that field shows twice. The line with all three Tags is green, and the old one is struck under it. The other green lines come later in this chapter, one by one.
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 PickupTagged Enemy Aircraft, Tagged Enemy Fire10.3131.31321.1887.18830Fighter Shadow0.844-1.313MG RoundSpread RoundRapid RoundNow you can see them, if you borrow the first V again. Open Mission Timeline, and in its first row, Wave 1: V at 3 s, pick Power Up Pickup in the object cell. The last part of this chapter makes the table new, so nothing has to be put back.
Save, and run the game. At three seconds, five orange badges come down in a V, swaying together. Fly into one. A chime, a sparkle, and it’s gone. Nothing gives a reward yet, and that’s the next part.
8.5 Rewards
Now each pickup gives something.
The rewards follow one rule. A pickup adds one to its count, a gun level, a medkit or a bomb, up to the most there can be. Past that, it gives bonus points instead. The gun level stops at 4, so a Power Up at gun level 4 gives 2000 points.
8.5.1 Pickups
The Pickups table holds each kind’s numbers and words, one row per kind. Its object column names the pickup’s Object. Its dropWeight says how often a dropped pickup is that kind, for a later part. Then come most and bonusPoints, the rule above, and last the words that rise and their color.
Name each row exactly as the card does, because the Logic finds a row by its name, as in data("Pickups", "Power Up", "most").
Spread Shot and Rapid Guns have 0 in most and bonusPoints. A weapon has no count to fill, so nothing reads those cells.
Make the table first. It makes its own Data Structure, Pickups Entry, and that’s the one its card names, so keep it, as you kept Waves Entry in Chapter 6. Open it, and add its six fields with Add Field, in the card’s order. Each comes as a Number named localVariable, at 0, so type the card’s name over localVariable and pick its Type.
The card calls the object field’s Type Thing Object. In the Field Type list it’s Object, near the bottom. Its Value reads None, as the card’s default does, and in each row you’ll pick the pickup from the cell’s list. For popupText, pick Text and delete the 0, so it starts empty. popupColor is a Color, and it starts white, #ffffff, the card’s default.
New rows start white too. Only the Medkit stays white. The card prints every cell, defaults too, so type them all if you like.
Power Up Pickup3042000POWER UP!#ffb347Spread Shot Pickup1800SPREAD SHOT!#8cff66Rapid Guns Pickup1600RAPID GUNS!#5ac8ffBomb Crate Pickup1651000+1 BOMB#ff7b6bMedkit Pickup2051500+1 MEDKIT#ffffff8.5.2 Show the Reward
The words always rise the same way. They start over the pickup, climb 1.563 meters and are gone in 0.9 seconds. Only the words and their color change. So one Function shows every reward.
Its PARAMETERS start with pickup, an Object, Structural, with a Transform, made with its pencil as round was on Fire a Volley. Next come words, a Text, and color, a Color, both near the top of Add Parameter’s Type list. A new Text’s Default starts empty, like the card’s. A new Color’s Default is already #FFFFFF, the card’s white. The three numbers then go in a section of their own, named Effects.
One block does the work, Popup Text. Its Applies To starts on pickup, since that’s the only Object Parameter here. Its boxes start with values of their own: +1 in Text, white in Color, and numbers in Size, Rise and Seconds. Type the card’s names over all five, and leave Font and Position Relative To as they start.
Myth can’t hand it a pickup from a reward yet. Pickup Rewards, next, says why, and what to build in its place until it can.
Shows what a collected pickup gave: the words rise from the pickup in the given color.
transformTransform- Applies To
pickup- Text
words- Color
color- Size
popupSize- Rise
popupRise- Seconds
popupSeconds
8.5.3 Pickup Rewards
The Fighter touches a Power Up, and the pickup sends powerUpCollected. Pickup Rewards, on Game Rules, hears it. Is the gun level below the Power Up row’s most? Then it goes up by one, and POWER UP! rises over the pickup in orange. If not, the score gets the row’s bonusPoints, and the words say how many: +2000.
How does it know where to show the words? In a Custom Event, other is the Object that sent the message. Here that’s the pickup. It’s among the Event’s Event Variables, and each call on the card hands Show the Reward other as its pickup.
Here Myth falls short. A call’s Pickup list holds self and From a Value, but not other, and other typed in its box is marked. The game won’t start with that mark. That’s Myth’s gap, not yours.
So for now, where the card calls Show the Reward, add that Function’s one block instead, a Popup Text. Pick Other in its Applies To, under Event Context. Its Size, Rise and Seconds then take Show the Reward’s three numbers, 0.813, 1.563 and 0.9. The words rise from the pickup as before.
Pickup Rewards has three Events, and each one listens for one pickup’s message. Choose Add Custom Event… and type the message’s name. The If is one box. Type the card’s condition whole. Right-click the If, and Add inside Then adds the True line’s blocks. Add Else makes the Else, and its own Add inside Else adds the Else line’s. Join each one with Connect to sequence.
Each line ends with its Popup Text. Its Text box keeps what you type as words, and a value in braces shows live, like the score’s {$score} on the screen. So on the Then line, put the call’s words in braces: {data("Pickups", "Power Up", "popupText")}. On the Else line the call’s words already have them, a plus sign and then the value. On the screen, +{data("Pickups", "Power Up", "bonusPoints")} shows as +2000.
The Color box is a swatch. Click it, and type the row’s popupColor from the Pickups card into its HEX box. The Power Up’s is #ffb347, orange. The Medkit’s stays on white, where it starts.
Gives the reward of each collected pickup, one more of its count up to the most or else bonus points, and shows it over the pickup.
Any Object$gunLevel < data("Pickups", "Power Up", "most")- Variable
$gunLevel- Operator
+=- Value
1
- pickup
other- words
data("Pickups", "Power Up", "popupText")- color
data("Pickups", "Power Up", "popupColor")
- Variable
$score- Operator
+=- Value
data("Pickups", "Power Up", "bonusPoints")
- pickup
other- words
+{data("Pickups", "Power Up", "bonusPoints")}- color
data("Pickups", "Power Up", "popupColor")
A Medkit works the same way, with $medkits and its own row. In Chapter 4 you placed five medkit icons, and only three have ever lit. A fourth and a fifth can now. Past five, it’s 1500 points.
$medkits < data("Pickups", "Medkit", "most")- Variable
$medkits- Operator
+=- Value
1
- pickup
other- words
data("Pickups", "Medkit", "popupText")- color
data("Pickups", "Medkit", "popupColor")
- Variable
$score- Operator
+=- Value
data("Pickups", "Medkit", "bonusPoints")
- pickup
other- words
+{data("Pickups", "Medkit", "bonusPoints")}- color
data("Pickups", "Medkit", "popupColor")
A Bomb Crate adds to $bombs, up to 5, or gives 1000 points. Its words rise in coral red, #ff7b6b. Nothing shows the bombs yet, but they’re counted, and the bombs part shows them.
$bombs < data("Pickups", "Bomb Crate", "most")- Variable
$bombs- Operator
+=- Value
1
- pickup
other- words
data("Pickups", "Bomb Crate", "popupText")- color
data("Pickups", "Bomb Crate", "popupColor")
- Variable
$score- Operator
+=- Value
data("Pickups", "Bomb Crate", "bonusPoints")
- pickup
other- words
+{data("Pickups", "Bomb Crate", "bonusPoints")}- color
data("Pickups", "Bomb Crate", "popupColor")
8.5.4 Game Rules
Attach Pickup Rewards to Game Rules. The last green line, Spend a Bomb, comes with the bombs.
X 3, Y 3Run Mission TimelineRun Mission Timeline DataSave, and run the game. The V of Power Ups comes down. Fly into one. POWER UP! rises in orange, and a second power pip lights in the bottom bar.
In Chapter 2 the bar got four pips, and only the first has ever lit. Collect three Power Ups, and all four glow. The next one gives +2000, and the score jumps.
8.6 Something Left Behind
Now a plane you shoot down may leave a pickup where it fell.
8.6.1 Enemy Stats
Enemy Stats gets two more fields. The first, dropChance, is how likely this plane is to leave a pickup, in a hundred. The other, damage, is for the bomb, two parts from now. Nothing reads it before then.
Press Add Field twice. Each new field is a Number named localVariable, so type the card’s names over them, and the damage field’s Value, 1.
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.
8.6.2 Enemy Types
In Enemy Types, each plane gets its dropChance. A Zero Fighter leaves a pickup 7 times in 100, a Red Ace 22, and a Dive Bomber 18. A Heavy Bomber always leaves one: 100.
The table gets both columns by itself, as it got bigExplosion in Chapter 7, and every new cell starts at 0. It doesn’t take the 1 you gave damage’s Value. That’s only where new rows start. So type each row’s dropChance, and a 1 in each damage cell, as the card’s green lines show.
5.93752100No714.68755300No2214.3756350No1811.71875362000Yes10018.6.3 Drops a Pickup
A plane goes down. Before it’s gone, it rolls a number from 0 to 100, as dropRoll. If the roll is under its dropChance, it drops a pickup.
Which pickup? Pick Data Row chooses one row of the Pickups table at random, by its dropWeight. The weights add up to 100, so each reads as a chance in a hundred. About 30 drops in 100 are Power Ups, and 18 are Spread Shots.
Pick Data Row’s answer is named droppedKind. The name of the row it picked is droppedKind.row, and Create Instance makes that row’s object, where the plane is.
Pick Data Row is one of two Actions that stay out of the Action List until Advanced Mode is on. Choose Settings > Advanced Mode at the top of the editor. Actions, one at a time says more.
It reads the plane’s Enemy Stats. Every plane carries them already, so press the + on its Data Structures card, and pick Enemy Stats under Existing Data Structures. Its one Event is a Custom Event, shotDown, which Shot Down will send. Choose Add Custom Event… and type it.
Go by the card in Pick Data Row. Table reads a small formula, so the table’s name goes in quotes, "Pickups". Weight Column takes a column’s name exactly as you type it, so dropWeight goes in bare. Quote marks there would become part of the name.
In Create Instance, pick From a Value (Variable, Data Table, Expression) at the bottom of Object to Create, and type the card’s value in the box that opens. Press Enter to keep it. Leave Position Relative To on World. The X and Y are the plane’s own place in the world.
When this enemy is shot down it may drop a pickup where it fell: its dropChance in a hundred, the kind picked by the Pickups table's dropWeight.
Any Objectself.enemyStats- Action Name
dropRoll- Maximum
100
dropRoll.value < self.enemyStats.dropChance- Action Name
droppedKind- Table
"Pickups"- Weight Column
dropWeight
- Object to Create
data("Pickups", droppedKind.row, "object")- X
self.transform.position.x- Y
self.transform.position.y
8.6.4 Shot Down
Shot Down already tells Game Rules that a plane went down, with enemyShotDown, for the score. Now it also tells the plane’s own Logic, with shotDown. Trigger Custom Event on Object rings the bell on its own Object only, since the card names no other.
It goes second, before the explosion and Destroy Instance. A message is answered at once, so Drops a Pickup still finds the plane where it fell.
Add Trigger Custom Event on Object from the Action List, and type shotDown, bare, in its Custom Event box. Connect to sequence would put it at the end, so drag the new block onto the arrow between Trigger Custom Event and the If. The bar under the canvas says Release to insert between Trigger Custom Event and If. Let go, and it joins the line there, second.
When this enemy has taken as many hits as its health it tells Game Rules (enemyShotDown) and its own Logic (shotDown), explodes and is removed.
Any Objectself.enemyStats- Custom Event
enemyShotDown
- Custom Event
shotDown
self.enemyStats.bigExplosion == true- Particles
"Big Explosion"- Count
@self.bigExplosionCount- Z Index Offset
2
- Particles
"Smoke Puff"- Count
@self.bigSmokeCount- Z Index Offset
2
- Sound
"Explosion Large"
- Intensity
@self.shakeStrength- Seconds
@self.shakeSeconds
- Particles
"Plane Explosion"- Count
@self.explosionCount- Z Index Offset
2
- Particles
"Smoke Puff"- Count
@self.smokeCount- Z Index Offset
2
- Sound
"Explosion Small"
8.6.5 The Four Planes
Each enemy plane gets Drops a Pickup: the Zero Fighter, the Red Ace, the Dive Bomber and the Heavy Bomber. Attach it at the end of each one’s Logic. It answers a message, so its place in the list doesn’t matter.
The other change is for the bomb. Under each plane’s Shared Variables, changeAmount turns into an Expression, as maximum and threshold did in Chapter 3. Pick Expression in its Kind list, and type the card’s line into the box, quotes and all. It reads the plane’s damage. For now damage is 1, so a round still counts one hit.
X 3, Y 3Off20Zero Fighter ArtX 3, Y 3X 1.5, Y 1.125Collide Only WithFighter, Tagged Fighter RoundEnemy StatsData TableEnemy TypesEnemy AircraftExpressionobjectComponentProperty("self","dataStruct","damage")ExpressionobjectComponentProperty("self","dataStruct","health")ExpressionobjectComponentProperty("self","dataStruct","health")Enemy RoundFighterZero Fighter Shadow0.75-1.125The other three get the same two changes, and your hands know them now.
X 3, Y 3Off21Red Ace ArtX 3, Y 3X 1.563, Y 1.188Collide Only WithFighter, Tagged Fighter RoundEnemy StatsData TableEnemy TypesEnemy AircraftExpressionobjectComponentProperty("self","dataStruct","damage")ExpressionobjectComponentProperty("self","dataStruct","health")ExpressionobjectComponentProperty("self","dataStruct","health")Red Ace Shadow0.75-1.125Enemy RoundFighterX 3, Y 3Off22Dive Bomber ArtX 3, Y 3X 1.813, Y 1.375Collide Only WithFighter, Tagged Fighter RoundEnemy StatsData TableEnemy TypesEnemy AircraftExpressionobjectComponentProperty("self","dataStruct","damage")ExpressionobjectComponentProperty("self","dataStruct","health")ExpressionobjectComponentProperty("self","dataStruct","health")Dive Bomber Shadow0.844-1.219Enemy RoundFighterX 3, Y 3Off19Heavy Bomber ArtX 3, Y 3X 2.625, Y 1.875Collide Only WithFighter, Tagged Fighter RoundEnemy StatsData TableEnemy TypesEnemy AircraftExpressionobjectComponentProperty("self","dataStruct","damage")ExpressionobjectComponentProperty("self","dataStruct","health")ExpressionobjectComponentProperty("self","dataStruct","health")Heavy Bomber Shadow1.031-1.594Enemy RoundFighterTry it on the borrowed V. Pick Heavy Bomber in the first row’s object cell, and type 1 in its count.
Save, and run the game. The Heavy Bomber crawls down the middle, firing fans of rounds. Bring it down. The camera shakes, and where it fell, a pickup drifts down.
Fly through it, and see what you got. A Power Up, a Medkit or a Bomb Crate gives its reward. A Spread Shot or Rapid Guns only chimes and sparkles for now. The weapons are the next part. It’s a good place to stop for a break, if you’d like one.
8.7 Three Weapons
Now two of the pickups change the guns.
8.7.1 Weapons
The bottom bar is about to name the weapon you’re flying with: MACHINE GUNS, SPREAD SHOT or RAPID GUNS. Two pieces of Logic write that name, Weapon Pickups and Mission Start. So the names live in one place, a small table, and both read them there. It has one row per weapon, and one Text column, label.
The new table makes Weapons Entry, its card’s Data Structure, as Pickups made Pickups Entry. Add its one field, label, pick Text, and delete the 0.
MACHINE GUNSSPREAD SHOTRAPID GUNS8.7.2 Weapon Name
Weapon Name shows $weaponName in the middle of the bottom bar. It’s a twin of High Score Text from Chapter 4, but it sits at the bottom, so duplicate High Score Text and name the copy Weapon Name. Change four things: its Screen Anchor to Bottom Center, its Text to {$weaponName}, its Font Size to 24 and its Size X to 260. Neither card has a Color line, so both keep the white a new Text / UI starts with.
Place it from PLACE THESE, with its Z-Index of 120. It reads MACHINE GUNS, the Global’s start, before any Logic touches it.
Window / UIBottom CenterUIX 128, Y 48{$weaponName}Bebas Neue241CenterWrap to Width2608.7.3 Spread Round and Rapid Round
The two new rounds are copies of the MG Round, the Fighter’s gold round. Each keeps its Tag, Fighter Round, and its Logic, so it hits enemies and leaves the view the same way. Duplicate the MG Round twice. Give each copy its name, its picture and its Collider’s Size.
A Spread Round is a small green ball, so its Collider is a small square. A Rapid Round is a pale blue streak, and its Collider is a little bigger than the gold round’s.
X 3, Y 335Spread Round ArtX 3, Y 3SensorX 0.375, Y 0.375Collide Only WithTagged Enemy AircraftFighter RoundX 3, Y 335Rapid Round ArtX 3, Y 3SensorX 0.313, Y 0.813Collide Only WithTagged Enemy AircraftFighter Round8.7.4 Sound the Guns
Every weapon fires with the same sound and the same flash at the nose. Until now, Fighter Guns made them itself, with a Control Sound and a Burst Particles. Three weapons would need three copies. So the two blocks move into a Function, Sound the Guns, and each weapon calls it.
Its PARAMETERS are Caller and the two numbers that went with the flash, muzzleFlashCount and muzzleFlashY, in a section named Effects. Both blocks work on Caller. The two numbers keep their own defaults, so every call passes only the Caller.
The gunfire sound and the muzzle flash at the Fighter's nose.
- Applies To
Caller- Sound
"Fighter Gunfire"
- Applies To
Caller- Particles
"Muzzle Flash"- Y
muzzleFlashY- Count
muzzleFlashCount- Z Index Offset
2
8.7.5 Fighter Guns
Fighter Guns is the dial from the start of the chapter. Its Event, While Fire Is Held, gets three Modes, one per weapon: Machine Guns, Spread Shot and Rapid Guns. While Fire is held, only one of them answers. Weapon Pickups turns the dial.
All three share one stopwatch, the fireRate cooldown from Chapter 2, and each winds it up with its own time: fireRateSeconds, spreadRateSeconds or rapidRateSeconds. So a new weapon waits until it runs down.
Start with the SHARED VARIABLES. The seven green ones are new, all Constants. spreadRound and rapidRound are Objects, and their Starting Value stays at None. The Fighter picks them. The two struck numbers at the bottom went to Sound the Guns, so delete each with the small red trash button at its row’s right end.
Next, the Modes. Right-click the Event’s one Mode, choose Rename Mode…, and name it Machine Guns. Then add Spread Shot and Rapid Guns with New Mode….
Modes stays on One at a time, so only one answers. The Starting Mode list says which. Keep it on Machine Guns, as the card’s (Starting Mode) has it.
Now the blocks. In Machine Guns, the struck Control Sound and Burst Particles go. Sound the Guns takes their place.
Add inside Then adds a block at the end of the If’s line. So the simplest way is to delete Fire a Volley too, then add the two calls in the card’s order, joining each with Connect to sequence.
The card doesn’t strike Fire a Volley, because it stays in the game. You only put it back, after Sound the Guns. It’s step 5 now, because two blocks before it became one.
Each caller list starts on self. Fire a Volley gets @self.round in round, and @self.roundSpeed in speed, as before.
While Fire is held, fires the current weapon each time its cooldown is over: Machine Guns, Spread Shot or Rapid Guns (one Mode each).
Any Object- Action Name
machineGunsReady- Cooldown Key
fireRate
machineGunsReady.value == true- Cooldown Key
fireRate- Seconds
@self.fireRateSeconds
- Sound
"Fighter Gunfire"
- Particles
"Muzzle Flash"- Y
@self.muzzleFlashY- Count
@self.muzzleFlashCount- Z Index Offset
2
- caller
self
- caller
self- round
@self.round- speed
@self.roundSpeed
Spread Shot calls Fire a Spread, from Chapter 7, straight up. Its count is one more than twice the gun level, and its arc is 20 degrees per gun level. So the rounds are always 10 degrees apart, and the fan grows with the gun level: three rounds at gun level 1, nine at gun level 4.
This whole Mode is new, the blocks on the If’s True line too. Each Mode has a line of its own, so give Spread Shot its blocks on its line. Its call’s caller starts on self, and its round list holds @self.spreadRound. Type the rest, muzzleX’s 0 too.
- Action Name
spreadShotReady- Cooldown Key
fireRate
spreadShotReady.value == true- Cooldown Key
fireRate- Seconds
@self.spreadRateSeconds
- caller
self
- caller
self- round
@self.spreadRound- count
1 + 2 * $gunLevel- direction
90- arc
@self.spreadArcPerLevel * $gunLevel- speed
@self.spreadSpeed- muzzleX
0- muzzleY
@self.spreadMuzzleY
Rapid Guns fires Fire a Volley, like the machine guns, with Rapid Rounds, every rapidRateSeconds. That’s 0.061 seconds, against the machine guns’ 0.11, so the rounds come almost twice as often.
- Action Name
rapidGunsReady- Cooldown Key
fireRate
rapidGunsReady.value == true- Cooldown Key
fireRate- Seconds
@self.rapidRateSeconds
- caller
self
- caller
self- round
@self.rapidRound- speed
@self.roundSpeed
On the Fighter, pick Spread Round in spreadRound’s list under Shared Variables, and Rapid Round in rapidRound’s, as the Fighter’s card in The pickups shows.
8.7.6 Weapon Pickups
Weapon Pickups turns the dial. It’s on the Fighter, and it hears the two weapon pickups’ messages.
Spread Shot is collected. Switch Mode turns While Fire Is Held to Spread Shot, and $weaponName becomes SPREAD SHOT, from the Weapons table. It also ends any Rapid Guns time: it stops the rapidGuns timer and sends rapidGunsEnded. Without that, a Rapid Guns timer from earlier would ring later and take the Spread Shot away. Last, SPREAD SHOT! rises over the pickup, in green.
Its one SHARED VARIABLE is rapidSeconds, a Constant. The pickup it shows the words over is the Event’s other, as in Pickup Rewards.
Attach Weapon Pickups to the Fighter first. Switch Mode picks from two lists. Its Event list names each Event with the Object that carries it, and While Fire Is Held is there as Fire Held · Fighter. Pick it. Its Mode list then holds the three weapons, so pick Spread Shot. Stop Recurring Timer’s Timer Name takes rapidGuns bare.
The words go up the same way as in Pickup Rewards, with a Popup Text in place of the call, Applies To on Other. Spread Shot’s color is #8cff66, a bright green.
Switches the Fighter's weapon when it collects Spread Shot or Rapid Guns, and shows it over the pickup; Rapid Guns lasts rapidSeconds, then the machine guns return.
Any Object- Event
While Fire Is Held (Fighter Guns)- Mode
Spread Shot
- Variable
$weaponName- Value
data("Weapons", "Spread Shot", "label")
- Timer Name
rapidGuns
- Custom Event
rapidGunsEnded
- pickup
other- words
data("Pickups", "Spread Shot", "popupText")- color
data("Pickups", "Spread Shot", "popupColor")
Rapid Guns is collected. The dial turns to Rapid Guns, and the name says RAPID GUNS. The rapidGuns timer starts, to ring once, rapidSeconds later: 10 seconds.
Its card fills Repeat Every too, with @self.rapidSeconds, though with Ring Once on Yes the timer never repeats. So that box changes nothing. Drift Down left it as it starts, and its card doesn’t print it. The meter hears rapidGunsStarted and shows, and RAPID GUNS! rises over the pickup in blue, #5ac8ff, from its Popup Text.
When the timer rings, Reset Modes turns the dial back to the Mode it starts with, Machine Guns, even if you had Spread Shot before. The name says MACHINE GUNS again, and rapidGunsEnded hides the meter. Reset Modes has one list, the Event. Pick Fire Held · Fighter.
- Event
While Fire Is Held (Fighter Guns)- Mode
Rapid Guns
- Variable
$weaponName- Value
data("Weapons", "Rapid Guns", "label")
- Timer Name
rapidGuns- Repeat Every (s)
@self.rapidSeconds- First Delay (s)
@self.rapidSeconds- Ring Once
Yes
- Custom Event
rapidGunsStarted
- pickup
other- words
data("Pickups", "Rapid Guns", "popupText")- color
data("Pickups", "Rapid Guns", "popupColor")
- Event
While Fire Is Held (Fighter Guns)
- Variable
$weaponName- Value
data("Weapons", "Machine Guns", "label")
- Custom Event
rapidGunsEnded
8.7.7 Rapid Meter
While Rapid Guns lasts, a thin blue bar under the power pips shows the time left. It’s a power pip, stretched. It has the same gold picture, at 120 pixels by 5, tinted blue on its placement.
Duplicate the Power Pip, and name the copy Rapid Meter. Type its Sprite’s Size, 120 by 5. The copy brings Show Gun Level along, so take it off with the red button at its row’s right end. Show Rapid Time goes on in its place, once you’ve made it in the next part.
Place it from PLACE THESE, hidden, so turn off Visible at Game Start. Its Tint goes on the placement: open Sprite under Rendering in its Properties, click the Tint swatch, and type 5AC8FF into the HEX box.
Window / UIBottom CenterUIX 128, Y 128102Power Pip ArtX 120, Y 5#5AC8FF8.7.8 Show Rapid Time
Rapid Guns starts. The bar appears at its full width and shrinks toward its left end, until it’s gone. It shrinks for rapidSeconds, 10 seconds, so its width is the Rapid Guns time left.
Tween does the shrinking. It moves a value, here the bar’s horizontal scale, from where it is to a Target, over some seconds, a little at each step. Its seconds are the game’s own, so a paused game holds the bar still. Tween is the second Advanced Mode Action. Advanced Mode is on already.
Set Scale goes first, so the bar always starts full, even if Rapid Guns comes again while it’s running. Its two boxes start at 1, which is full, so leave them. Set Visible’s Visible is a list, and it starts on No. Pick Yes in the one under On Rapid Guns Started, and leave the one under On Rapid Guns Ended as it is. In Tween, type self.transform.scale.x, the bar’s horizontal scale, into its Value box, and type @self.rapidSeconds into Duration.
This rapidSeconds and Weapon Pickups’ are two Shared Variables, both 10. Change one, and change the other.
Shows the Rapid Guns meter while Rapid Guns lasts, shrinking to nothing as its time runs out.
Any Object- Visible
Yes
- Value
self.transform.scale.x- Target
0- Duration
@self.rapidSeconds
- Visible
No
Attach Show Rapid Time to the Rapid Meter, and borrow the first V once more: pick Spread Shot Pickup in its object cell. Its count is still 1.
Save, and run the game. At three seconds, one green badge drifts down the middle. Fly into it. SPREAD SHOT! rises in green, and the bottom bar says SPREAD SHOT. Hold Space, and three green rounds fan out.
Next, try Rapid Guns Pickup in the same cell. Blue rounds pour out, and a blue bar under the pips shrinks away. When it’s gone, the gold rounds come back.
8.8 Bombs
Last comes the bomb.
8.8.1 Bomb Shockwave
When a bomb goes off, a ring of light bursts from the Fighter: 140 puffs, white, ice blue and sky blue, flying out fast and fading as they shrink. The Big Explosion, from Chapter 4, bursts with it.
01400.938min 450, max 800min 16.25, max 21.875FX Smoke PuffMultiple Colors#FFFFFF, #CFEFFF, #7FD4FF1.5start 1.2, end 0.2start 0.9, end 08.8.2 Show Bombs
The bombs show the way the medkits do, as icons in a row. Show Bombs is Show Medkits from Chapter 4, with $bombs where $medkits was. When an icon appears, and whenever $bombs changes, it asks Show If At Least, with this icon’s level.
Make it the same way. Its level is the card’s PER INSTANCE VARIABLES, as on Show Medkits. Its second Event is a Variable Changed, and Myth Engine asks which Global Variable, so pick bombs. In each call, caller starts on self. Type $bombs into the value box and self.level into the level box.
Shows this bomb icon while the Fighter has at least its number of bombs (1 to 5).
Any Object- caller
self- value
$bombs- level
self.level
- caller
self- value
$bombs- level
self.level
8.8.3 Bomb Icon and Bomb Label
The Bomb Icon is a small black bomb with a red cap, and BOMBS sits above the row of them, in the same coral red as MEDKITS.
Both are twins of the medkits’ pieces. Duplicate the Medkit Icon, name the copy Bomb Icon, and pick Bomb Icon Art in its Sprite box. Its copy of Show Medkits comes along. Take it off with the red button at its row’s right end, and attach Show Bombs.
For the label, duplicate the Medkit Label and name it Bomb Label. Type BOMBS in its Text, and press Align Right.
Window / UIBottom CenterUIX 128, Y 128102Bomb Icon ArtX 32, Y 32Window / UIBottom CenterUIX 128, Y 48BOMBSBebas Neue18#FF8A801RightWrap to Width180Place the icon five times from PLACE THESE, in a row at the bottom right of the window. The line under four of the rows, such as with Per Instance Variables > Level = 2, is that icon’s own level. Type it into the Level box. That box is in Show Bombs’ section of each placement’s Logic, as for the medkits. Level 1 is at the right end, so the row fills from the right. The label goes above them, with its Z-Index of 120.
Save, and run the game, if you like. Two bombs glow at the bottom right, under BOMBS, and that’s where a Bomb Crate’s bombs go.
8.8.4 Drops Bombs
Press B. A white flash, a burst of light from the Fighter, the Bomb Blast, and the camera shakes. Every enemy round in the sky breaks, and every enemy plane takes a heavy hit. One bomb icon goes out.
Drops Bombs, on the Fighter, starts all that. It’s a Command Pressed Event, which runs once each time Bomb is pressed. Myth Engine asks which Command, so pick Bomb, and make its six SHARED VARIABLES, all Constants, before the blocks.
When it runs, it first asks two things. Is the mission still being played, and is there a bomb left? Its If is one box, the two questions joined by &&, which means and. Type the card’s condition whole.
If both are yes, the Fighter is protected for a moment, protectSeconds, 1.2 seconds, unless it’s protected already. A bomb right after a hit mustn’t cut that hit’s longer protection short. So Check Cooldown Ready asks the protection stopwatch first, and Start Protection runs only when it has run down. In the call, caller starts on self. Type @self.protectSeconds into seconds.
The rest is the show: the two bursts, the sound, the flash and the shake. Last, Trigger Custom Event rings bombDropped for everything in the sky. Only what exists at that moment hears it, so a round fired a moment later is safe from this bomb.
The inner If sits on the outer If’s True line, and so do the steps after it. Add each with the outer If’s own Add inside Then, on its right-click menu, and join it with Connect to sequence. It joins the end of the outer True line, after the inner If. Camera Flash starts white. That’s the flash the bomb wants, so the card gives only its Seconds.
Pressing Bomb while the mission is being played, with a bomb left, sets one off: everything in the sky hears bombDropped, and the Fighter is protected for a moment.
Any Object- Action Name
stillPlaying- Game State
Playing
stillPlaying.value == true && $bombs > 0- Action Name
protectionOver- Cooldown Key
protection
protectionOver.value == true- caller
self- seconds
@self.protectSeconds
- Particles
"Bomb Shockwave"- Count
@self.bombShockwaveCount- Z Index Offset
2
- Particles
"Big Explosion"- Count
@self.bombExplosionCount- Z Index Offset
2
- Sound
"Bomb Blast"
- Seconds
@self.flashSeconds
- Intensity
@self.bombShakeStrength- Seconds
@self.bombShakeSeconds
- Custom Event
bombDropped
Attach Drops Bombs to the Fighter.
8.8.5 Spend a Bomb
Game Rules keeps the count. When bombDropped comes, Spend a Bomb takes one from $bombs, with -= in the Operator list.
Its card has no Shared Variables. It needs none, because it only changes a Global Variable.
Each bomb set off takes one from $bombs.
Any Object- Variable
$bombs- Operator
-=- Value
1
Attach it to Game Rules, as the Game Rules card in Rewards shows.
8.8.6 Breaks on Bomb
Every enemy round hears bombDropped too. Each one throws a small spark of Hit Sparks and removes itself.
It has one Shared Variable, blastSparksCount, a Constant, and its blocks work on the round it’s attached to.
An enemy round breaks with a small spark when a bomb goes off.
Any Object- Particles
"Hit Sparks"- Count
@self.blastSparksCount- Z Index Offset
2
Attach Breaks on Bomb to the Enemy Round. Every round the enemies fire is an Enemy Round, so that’s all of them.
X 3, Y 345Enemy Round ArtX 3, Y 3SensorX 0.313, Y 0.313Collide Only WithFighterEnemy Fire8.8.7 Takes Hits
Every enemy plane hears bombDropped as well. Takes Hits counts the blast on its meter, as bombDamage, 25 hits at once. Zero Fighters, Red Aces and Dive Bombers go down. A Heavy Bomber, with 36, flies on, badly hurt.
Here’s where damage comes in. Meter with Thresholds adds its changeAmount, and changeAmount now reads the plane’s damage. So Takes Hits sets damage right before each changeMeter: bombDamage for a bomb, roundDamage, 1, for a round.
Why set it on every round? The field keeps its last value. After a bomb it would still say 25, and every round after that would count 25 too.
Why a field, not a Shared Variable of Takes Hits? A Logic’s own Variables are its alone, so Meter with Thresholds couldn’t read one. The Enemy Stats each plane carries can be read by both.
Takes Hits gets the plane’s Enemy Stats, from the + on its Data Structures card, under Existing Data Structures. Then come two new Shared Variables, roundDamage and bombDamage, both Constants.
Change Component Value goes between Start Recurring Timer and Trigger Custom Event on Object. Add it from the Action List, and drag it onto the arrow between those two, as you did in Shot Down. Its Component Value takes self.enemyStats.damage, typed as the card spells it. The new Event, On Bomb Dropped, listens for bombDropped.
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
- Property
Enabled- Value
false
- Component Value
self.enemyStats.damage- Value
@self.bombDamage
- Custom Event
changeMeter
Save, and run the game. When Wave 1’s columns come in and their rounds are in the air, press B. The sky flashes white and shakes. The rounds break into sparks, the Zero Fighters go down in smoke, and one bomb icon goes out.
Press B twice more. The second bomb goes off, and the third press does nothing.
8.9 The Whole Mission
Now the pickups join the mission.
8.9.1 Mission Start
Each mission has to start fresh. Restart one with FLY AGAIN, and the Globals keep what the last mission left them: maybe RAPID GUNS on the bottom bar, and no bombs.
So Mission Start sets two more things. The weapon’s name, $weaponName, goes back to the Weapons table’s MACHINE GUNS. And $bombs goes back to startBombs, 2, a new Shared Variable under the other two, a Constant. The Fighter’s weapon needs nothing. A new mission makes the Fighter again, and its dial starts on Machine Guns.
Sets up a fresh mission each time the Gameplay Scene starts: Playing, score 0, startMedkits medkits, gun level startGunLevel.
Any Object- Game State
Playing
- Variable
$score- Value
0
- Variable
$medkits- Value
@self.startMedkits
- Variable
$gunLevel- Value
@self.startGunLevel
- Variable
$weaponName- Value
data("Weapons", "Machine Guns", "label")
- Variable
$bombs- Value
@self.startBombs
8.9.2 Mission Timeline
The Mission Timeline grows to 54 rows. The new eight are supply drops. Each one’s formation is Supply Drop, its object a pickup, and its count 1.
They come at their times among the planes. So, as in Chapter 7, the old rows go first. Rows added to a kept table would come at the end, after the last row. On the Changes card, the old file is struck, and the new one is green.
The steps are the same. Press Clear All Rows under the grid, and Clear Rows in its window. The seven columns stay as they are. Download the file from the card’s File line, and import it. Myth counts 54 new rows. The borrowed V is gone with the old rows.
3VZero Fighter11.2552.2535.93756.5ColumnZero Fighter5.312542.812535.93756.5ColumnZero Fighter17.187542.812535.93758.9.3 Make a Row Arrive
A supply drop needs no formation. Make a Row Arrive makes its one pickup, at the row’s x and entryY.
Its new If goes first. Add it from the Action List, and drag it onto the arrow between Start and the first If. The bar says Release to insert between Start and If, and it joins the line at the top. Its condition is one box, like the other four. Type it whole, with "Supply Drop" in double quotes, as the card has it.
Add inside Then, on its menu, adds Create Instance, whose Applies To starts on Caller, the Function’s only Object Parameter. In Object to Create, pick From a Value, type the card’s value into the box, and press Enter. Type X and Y the same way, each with its own Enter.
Makes one Mission Timeline row arrive: the Object its object cell names, in the row's formation (a supply drop: one pickup).
data("Mission Timeline", row, "formation") == "Supply Drop"- Applies To
Caller- Object to Create
data("Mission Timeline", row, "object")- X
data("Mission Timeline", row, "x")- Y
data("Mission Timeline", row, "entryY")
data("Mission Timeline", row, "formation") == "V"- caller
Caller- enemy
data("Mission Timeline", row, "object")- x
data("Mission Timeline", row, "x")- count
data("Mission Timeline", row, "count")- spacing
data("Mission Timeline", row, "spacing")- entryY
data("Mission Timeline", row, "entryY")
data("Mission Timeline", row, "formation") == "Column"- caller
Caller- enemy
data("Mission Timeline", row, "object")- x
data("Mission Timeline", row, "x")- count
data("Mission Timeline", row, "count")- gap
data("Mission Timeline", row, "spacing")- entryY
data("Mission Timeline", row, "entryY")
data("Mission Timeline", row, "formation") == "Row"- caller
Caller- enemy
data("Mission Timeline", row, "object")- count
data("Mission Timeline", row, "count")- entryY
data("Mission Timeline", row, "entryY")
data("Mission Timeline", row, "formation") == "Side Sweep"- caller
Caller- enemy
data("Mission Timeline", row, "object")- edgeX
data("Mission Timeline", row, "x")- count
data("Mission Timeline", row, "count")
Save, and run the game. Let the mission run.
In Wave 1, a Power Up drifts down the middle by itself. Later waves bring a Spread Shot, Rapid Guns, Medkits and a Bomb Crate, and every plane you bring down might leave one more. Every reward in the game is in your mission now.
Watch for each of these.
- A Zero Fighter you shoot down sometimes leaves a pickup where it fell, about 7 times in 100.
- In Wave 1, a Power Up drifts down the middle, swaying. Miss it, and it vanishes near the bottom.
- Fly through a Power Up: a chime, a sparkle, POWER UP! in orange, and one more power pip. At gun level 4, it’s +2000.
- When enemy rounds fill the sky, press B. A white flash, a shake and a ring of light. Every enemy round breaks, and every plane but a Heavy Bomber goes down. One bomb icon goes out.
- Press B again with no bombs left, and nothing happens.
- In Wave 2, fly through Spread Shot. SPREAD SHOT! rises in green, and the bottom bar says SPREAD SHOT. Hold Space for a fan of green rounds, three at gun level 1 and more at each level after.
- A Medkit gives +1 MEDKIT, in white, and lights one more medkit icon, up to five.
- In Wave 3, fly through Rapid Guns. Blue rounds come almost twice as fast, and a thin blue bar under the pips shrinks for 10 seconds. When it’s gone, the machine guns are back.
- Every Heavy Bomber you bring down leaves a pickup.
- In Wave 4, a Bomb Crate gives +1 BOMB, in red, and an icon lights. At 5 bombs, it’s +1000.
- Lose the mission and fly again: MACHINE GUNS, and two bombs.
A plane goes down and tells its own Logic, and the drop is a roll and a table row. A pickup is touched and says which pickup it was, and Game Rules or the Fighter gives the reward. The words rise over the pickup. The weapon is a Mode, and a pickup turns the dial. A bomb is one message, rung once.
Underneath is an idea you’ve met before, now doing more: messages let each piece mind its own job. The pickup never knows what it gives. The bomb never looks for rounds. It rings once, and everything in the sky at that moment answers in its own way: rounds break, planes count the hit, and Game Rules takes a bomb away.
8.10 If It Didn’t Work
Something may be a little off the first time. That’s normal. This chapter has many small pieces, so run the game, find the one that misbehaves, and watch what it does.
No pickup comes down at all, on the borrowed V? Is Drift Down there, on the pickup the object cell names, in its Logic? A pickup that never moves waits above the window.
A pickup flies up instead of down? In Drift Down’s Set Velocity, the Y Velocity is -@self.fallSpeed, with its minus.
A pickup falls straight, with no sway? Look at the pickup’s Logic: Weave should be there, and under Shared Variables, weaveSpeed 1.719.
You fly through a pickup, and nothing happens? Perhaps the two can’t touch. First, does the pickup wear the Tag Pickup, under its Tags? The Fighter’s Collide Only With should list Tagged Pickup, and the pickup’s should list the Fighter. Last, look at the Collision Target of Collected by Fighter’s Event. It should say Fighter.
The pickup sparkles and goes, but gives nothing? A Spread Shot or Rapid Guns gives nothing until the weapons part is built.
For any other pickup, look in Collected by Fighter: Trigger Custom Event’s box should read @self.collectedEvent, with its @. After that, check the pickup’s collectedEvent spelling against the card, and that Pickup Rewards is on Game Rules.
Every pickup chimes the same? Look at Control Sound in Collected by Fighter. Its Sound should be @self.collectSound, from the bottom of its list, not one sound picked for all.
The reward comes, but no words rise? Look at the Popup Text in that Event, in Pickup Rewards or Weapon Pickups. Its Applies To should say Other. Words that show their own braces, or the data() itself? Count the braces in its Text box, one before the data and one after.
Pick Data Row isn’t in the Action List? Turn on Advanced Mode, under Settings.
No plane ever leaves anything, not even a Heavy Bomber? Is Drops a Pickup on each plane, at the end of its Logic? Is each row’s dropChance typed in Enemy Types? Then look at Shot Down’s second step, Trigger Custom Event on Object, with shotDown. Last, Drops a Pickup’s If compares dropRoll.value with self.enemyStats.dropChance, using <.
You collect Spread Shot, and the guns don’t change? Is Weapon Pickups on the Fighter? Its Switch Mode should name Fire Held · Fighter and Spread Shot.
Spread Shot fires one round, or many on one line? Look at the call to Fire a Spread: count is 1 + 2 * $gunLevel, and arc is spreadArcPerLevel * $gunLevel.
Rapid Guns never ends? Its timer’s name is rapidGuns, bare, in Start and Stop Recurring Timer and on the When bar.
The blue bar never shows? Is Show Rapid Time on the Rapid Meter, with Set Visible on Yes in its first Event?
The bar fades away instead of shrinking? Tween’s Value should be self.transform.scale.x, the bar’s horizontal scale, not self.transform.opacity.
B does nothing? Check the Bomb Command’s two keys in the Input Manager, and that Drops Bombs is on the Fighter. Its If is one box, with $bombs > 0 after the &&.
B clears the rounds, but no plane goes down? Look in Takes Hits for On Bomb Dropped. If it’s there, look at the plane’s Shared Variables: changeAmount should be an Expression that reads damage.
After a bomb, every plane goes down at one hit? Perhaps On Round Hit doesn’t set damage back to roundDamage. Its Change Component Value should give self.enemyStats.damage that value, right before changeMeter.
The bomb icons never change? Is Spend a Bomb on Game Rules, and does Show Bombs’ second Event watch bombs?
Supply drops all come at once, near the end? Your table kept its old rows. Make it new, as in the last part, and import the file again.
The game won’t start, and Myth says Can’t run yet? Its message names the Logic Component that’s wrong. Open it, and the Errors bar under the canvas says which block. Count the quotes. A call to Show the Reward that hands it other is the one Myth refuses for now. A Popup Text takes its place.
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. Chapter 9’s cards expect your tables to hold only theirs. So work in a copy.
Choose File > Save as… next, 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 9 from this chapter’s catch-up download.
Now make a pickup of your own. Duplicate the Medkit Pickup, and give it a message of its own. What should it give? Points, a longer blink of protection, or something no one has thought of yet.
Give it a row in Pickups, with a dropWeight, so shot-down planes can leave it. Last, give the reward a home: an Event in Pickup Rewards, or in Weapon Pickups, on the Fighter. It can borrow a picture for now. What would you call it?
Still stuck? Search the manual, or ask in the Myth Engine Discord (opens a new tab).
Every pickup works now, and so do the bombs. In Chapter 9, a WARNING blinks, and the last enemy comes.
