Build a GameCreating Sky Ace

8  Pickups, Weapons and Bombs

Goal

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.

Sky Ace, Chapter 8 finishedZip of a Myth project · 4.2 MB

To open it, right-click the downloaded file, choose Extract All... and then Extract. Start Myth Engine, choose File › Open Project... and pick the .mythproj file in the new folder. Beside it, OFL.txt is the license of the project’s font, Bebas Neue.

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.

Set upWhat this chapter adds
ART (sprites, from the starter kit)
Power Pickup Art
Spread Pickup Art
Rapid Pickup Art
Bomb Pickup Art
Medkit Pickup Art
Spread Round Art
Rapid Round Art
Bomb Icon Art
SOUNDS (from the starter kit)
Power Up Chime
Weapon Swap
Medkit Chime
Bomb Blast
COMMANDS (Game Settings > Input Manager)
BombButton
KeybindingsB, K
GLOBAL VARIABLES
$weaponNameTextstarts at MACHINE GUNS
$bombsNumberstarts at 2
SCENE Gameplay: PLACE THESE
ObjectXY
Weapon Name0114
with Z-Index = 120
Rapid Meter-6070hidden
Bomb Icon31684
Bomb Icon28484
with Per Instance Variables > Level = 2
Bomb Icon25284
with Per Instance Variables > Level = 3
Bomb Icon22084
with Per Instance Variables > Level = 4
Bomb Icon18884
with Per Instance Variables > Level = 5
Bomb Label260116
with Z-Index = 120

8.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.

Particle EffectPickup Sparkle
Emitter
Emission > Emit Every (ms)0
Emission > Burst Count18
Emitter Shape > Emit Radius (m)0.25
Motion
Lifecycle > Each Particle Lives (ms)min 250, max 600
Motion > Speed (m/s)min 1.875, max 5.625
Appearance
Appearance > Particle SpriteFX Spark
Appearance > Color SourceMultiple Colors
Appearance > Multiple Colors#FFFFFF, #FFF3B0, #FFD24A
Appearance > Glow1.5
Appearance Over Life > Scalestart 0.7, end 0

8.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.

Logic ComponentWeaveAttach to: Red Ace, Power Up Pickup, Spread Shot Pickup, Rapid Guns Pickup, Bomb Crate Pickup, Medkit PickupAddDelete

Weaves from side to side on the way down: the sideways speed follows a slow wave, starting at a random point of it.

Attach toAny Object
DATA STRUCTURES
Weave Dataself.weaveData
SHARED VARIABLES
NameTypeKindStarting Value
weaveSpeedNumberConstant6.563
weaveRateNumberConstant2.4
phaseMaxNumberConstant6.28
When Created
WhenCreate
1Generate Random Number
Action Name
phaseRoll
Maximum
@self.phaseMax
Maximum
6.28
2Change Component Value
Component Value
self.weaveData.weavePhase
Value
phaseRoll.value
Every Step
WhenStep
1Change Component Value
Component Value
self.weaveData.secondsFlown
Operator
+=
Value
$deltaTime
2Set Velocity
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.

Logic ComponentDrift DownAttach to: Power Up Pickup, Spread Shot Pickup, Rapid Guns Pickup, Bomb Crate Pickup, Medkit Pickup

Falls straight down at fallSpeed and is removed once it is below lowestY.

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
fallSpeedNumberConstant2.344
lowestYNumberConstant2.5
When Created
WhenCreate
1Declare Variable
Name
secondsToLowest
Value
0
2Set Velocity
Y Velocity
-@self.fallSpeed
3Change Variable
Variable
secondsToLowest
Value
(self.transform.position.y - @self.lowestY) / @self.fallSpeed
4IfsecondsToLowest < 0
Then
5Change Variable
Variable
secondsToLowest
Value
0
6Start Recurring Timer
Timer Name
sinking
First Delay (s)
secondsToLowest
Ring Once
Yes
On the Sinking Timer
WhenRecurring TimerTimer name: sinking
1Destroy Instance

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.

Logic ComponentCollected by FighterAttach to: Power Up Pickup, Spread Shot Pickup, Rapid Guns Pickup, Bomb Crate Pickup, Medkit Pickup

When the Fighter touches this pickup while the mission is being played, it plays its sound and sparkle, sends its collectedEvent and is removed.

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
collectSoundSoundConstantPower Up Chime
pickupSparkleCountNumberConstant18
collectedEventTextConstantpowerUpCollected
When Starting to Hit Fighter
WhenCollision EnterObject: Fighter
1Check Game State
Action Name
stillPlaying
Game State
Playing
2IfstillPlaying.value == true
Then
3Control Sound
Sound
@self.collectSound
4Burst Particles
Particles
"Pickup Sparkle"
Count
@self.pickupSparkleCount
Z Index Offset
2
5Trigger Custom Event
Custom Event
@self.collectedEvent
6Destroy Instance

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.

ObjectPower Up Pickup
Transform
Bounding Box > SizeX 3, Y 3
Sprite
Scene Depth Draw Order25
SpritePower Pickup Art
Transform > SizeX 3, Y 3
Collider
CollisionSensor
Shape and Transform > SizeX 1.25, Y 1.25
Tags and Interactions > InteractionsCollide Only With
Tags and Interactions > Collide Only WithFighter
Tags
Object TagsPickup
Data Structure
From LogicWeave
Data StructureWeave Data
Logic
Collected by Fighter
Drift Down
Weave
Remove When Out of View
Shared Variables
weaveSpeed1.719
weaveRate2.2
phaseMax0

8.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.

ObjectSpread Shot Pickup
Transform
Bounding Box > SizeX 3, Y 3
Sprite
Scene Depth Draw Order25
SpriteSpread Pickup Art
Transform > SizeX 3, Y 3
Collider
CollisionSensor
Shape and Transform > SizeX 1.25, Y 1.25
Tags and Interactions > InteractionsCollide Only With
Tags and Interactions > Collide Only WithFighter
Tags
Object TagsPickup
Data Structure
From LogicWeave
Data StructureWeave Data
Logic
Collected by Fighter
Drift Down
Weave
Remove When Out of View
Shared Variables
weaveSpeed1.719
weaveRate2.2
phaseMax0
collectSoundWeapon Swap
collectedEventspreadShotCollected
ObjectRapid Guns Pickup
Transform
Bounding Box > SizeX 3, Y 3
Sprite
Scene Depth Draw Order25
SpriteRapid Pickup Art
Transform > SizeX 3, Y 3
Collider
CollisionSensor
Shape and Transform > SizeX 1.25, Y 1.25
Tags and Interactions > InteractionsCollide Only With
Tags and Interactions > Collide Only WithFighter
Tags
Object TagsPickup
Data Structure
From LogicWeave
Data StructureWeave Data
Logic
Collected by Fighter
Drift Down
Weave
Remove When Out of View
Shared Variables
weaveSpeed1.719
weaveRate2.2
phaseMax0
collectSoundWeapon Swap
collectedEventrapidGunsCollected
ObjectBomb Crate Pickup
Transform
Bounding Box > SizeX 3, Y 3
Sprite
Scene Depth Draw Order25
SpriteBomb Pickup Art
Transform > SizeX 3, Y 3
Collider
CollisionSensor
Shape and Transform > SizeX 1.25, Y 1.25
Tags and Interactions > InteractionsCollide Only With
Tags and Interactions > Collide Only WithFighter
Tags
Object TagsPickup
Data Structure
From LogicWeave
Data StructureWeave Data
Logic
Collected by Fighter
Drift Down
Weave
Remove When Out of View
Shared Variables
weaveSpeed1.719
weaveRate2.2
phaseMax0
collectedEventbombCrateCollected
ObjectMedkit Pickup
Transform
Bounding Box > SizeX 3, Y 3
Sprite
Scene Depth Draw Order25
SpriteMedkit Pickup Art
Transform > SizeX 3, Y 3
Collider
CollisionSensor
Shape and Transform > SizeX 1.25, Y 1.25
Tags and Interactions > InteractionsCollide Only With
Tags and Interactions > Collide Only WithFighter
Tags
Object TagsPickup
Data Structure
From LogicWeave
Data StructureWeave Data
Logic
Collected by Fighter
Drift Down
Weave
Remove When Out of View
Shared Variables
weaveSpeed1.719
weaveRate2.2
phaseMax0
collectSoundMedkit Chime
collectedEventmedkitCollected

8.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.

ObjectFighterAddDelete
Transform
Bounding Box > SizeX 3, Y 3
Physics > Physics ObjectOff
Sprite
Scene Depth Draw Order30
SpriteFighter Art
Transform > SizeX 3, Y 3
Collider
Shape and Transform > PositionX 0, Y -0.094
Shape and Transform > SizeX 0.656, Y 0.75
Tags and Interactions > InteractionsCollide Only With
Tags and Interactions > Collide Only WithTagged Enemy Aircraft, Tagged Enemy Fire, Tagged Pickup
Tags and Interactions > Collide Only WithTagged Enemy Aircraft, Tagged Enemy Fire
Logic
Top-down Controls
Keep Inside Box
Fighter Guns
Hurt by Enemies
Protection Blink
Lost With the Last Medkit
Cast Shadow
Weapon Pickups
Drops Bombs
Shared Variables
moveSpeed10.313
minimumX1.313
maximumX21.188
minimumY7.188
maximumY30
shadowFighter Shadow
offsetX0.844
offsetY-1.313
roundMG Round
spreadRoundSpread Round
rapidRoundRapid Round

Now 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.

Data TablePickupsData Structure: Pickups Entry
Row 0Power Up
objectPower Up Pickup
dropWeight30
most4
bonusPoints2000
popupTextPOWER UP!
popupColor#ffb347
Row 1Spread Shot
objectSpread Shot Pickup
dropWeight18
most0
bonusPoints0
popupTextSPREAD SHOT!
popupColor#8cff66
Row 2Rapid Guns
objectRapid Guns Pickup
dropWeight16
most0
bonusPoints0
popupTextRAPID GUNS!
popupColor#5ac8ff
Row 3Bomb Crate
objectBomb Crate Pickup
dropWeight16
most5
bonusPoints1000
popupText+1 BOMB
popupColor#ff7b6b
Row 4Medkit
objectMedkit Pickup
dropWeight20
most5
bonusPoints1500
popupText+1 MEDKIT
popupColor#ffffff

8.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.

FunctionShow the Reward

Shows what a collected pickup gave: the words rise from the pickup in the given color.

PARAMETERS
NameTypeStarts at
pickupObjectStructural
Required Components
Slot Nametransform
Component TypeTransform
wordsText
colorColor#ffffff
SectionEffects
popupSizeNumber0.813
popupRiseNumber1.563
popupSecondsNumber0.9
ACTIONS
1Popup Text
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.

Logic ComponentPickup RewardsAttach to: Game Rules

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.

Attach toAny Object
On Power Up Collected
WhenpowerUpCollectedCustom Event
1If$gunLevel < data("Pickups", "Power Up", "most")
Then
2Change Variable
Variable
$gunLevel
Operator
+=
Value
1
3Show the RewardFunction
pickup
other
words
data("Pickups", "Power Up", "popupText")
color
data("Pickups", "Power Up", "popupColor")
4Otherwise
5Change Variable
Variable
$score
Operator
+=
Value
data("Pickups", "Power Up", "bonusPoints")
6Show the RewardFunction
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.

Logic ComponentPickup Rewardscontinued
On Medkit Collected
WhenmedkitCollectedCustom Event
1If$medkits < data("Pickups", "Medkit", "most")
Then
2Change Variable
Variable
$medkits
Operator
+=
Value
1
3Show the RewardFunction
pickup
other
words
data("Pickups", "Medkit", "popupText")
color
data("Pickups", "Medkit", "popupColor")
4Otherwise
5Change Variable
Variable
$score
Operator
+=
Value
data("Pickups", "Medkit", "bonusPoints")
6Show the RewardFunction
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.

Logic ComponentPickup Rewardscontinued
On Bomb Crate Collected
WhenbombCrateCollectedCustom Event
1If$bombs < data("Pickups", "Bomb Crate", "most")
Then
2Change Variable
Variable
$bombs
Operator
+=
Value
1
3Show the RewardFunction
pickup
other
words
data("Pickups", "Bomb Crate", "popupText")
color
data("Pickups", "Bomb Crate", "popupColor")
4Otherwise
5Change Variable
Variable
$score
Operator
+=
Value
data("Pickups", "Bomb Crate", "bonusPoints")
6Show the RewardFunction
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.

ObjectGame RulesAddDelete
Transform
Bounding Box > SizeX 3, Y 3
Data Structure
From LogicRun Mission Timeline
Data StructureRun Mission Timeline Data
Logic
Add Points
Run Mission Timeline
Lose a Medkit
Lose a Gun Level
Mission Start
Mission Clock
High Score
Mission Music
Mission Failed
Fly Again(turned off)
Run Waves
Pickup Rewards
Spend a Bomb

Save, 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.

Data StructureEnemy StatsAddDelete

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.

speedNumberdefault 0
healthNumberdefault 1
pointsNumberdefault 0
bigExplosionBooleandefault false
dropChanceNumberdefault 0
damageNumberdefault 1

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.

Data TableEnemy TypesData Structure: Enemy StatsAddDelete
Row 0Zero Fighter
speed5.9375
health2
points100
bigExplosionNo
dropChance7
damage1
Row 1Red Ace
speed4.6875
health5
points300
bigExplosionNo
dropChance22
damage1
Row 2Dive Bomber
speed4.375
health6
points350
bigExplosionNo
dropChance18
damage1
Row 3Heavy Bomber
speed1.71875
health36
points2000
bigExplosionYes
dropChance100
damage1

8.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.

Logic ComponentDrops a PickupAttach to: Zero Fighter, Red Ace, Dive Bomber, Heavy Bomber

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.

Attach toAny Object
DATA STRUCTURES
Enemy Statsself.enemyStats
On Shot Down
WhenshotDownCustom Event
1Generate Random Number
Action Name
dropRoll
Maximum
100
2IfdropRoll.value < self.enemyStats.dropChance
Then
3Pick Data Row
Action Name
droppedKind
Table
"Pickups"
Weight Column
dropWeight
4Create Instance
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.

Logic ComponentShot DownAttach to: Zero Fighter, Red Ace, Dive Bomber, Heavy BomberAddDelete

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.

Attach toAny Object
DATA STRUCTURES
Enemy Statsself.enemyStats
SHARED VARIABLES
NameTypeKindStarting Value
bigExplosionCountNumberConstant70
bigSmokeCountNumberConstant16
shakeStrengthNumberConstant0.012
shakeSecondsNumberConstant0.35
explosionCountNumberConstant36
smokeCountNumberConstant8
On Meter Threshold Reached
WhenMeter Threshold Reached
1Trigger Custom Event
Custom Event
enemyShotDown
2Trigger Custom Event on Object
Custom Event
shotDown
3Ifself.enemyStats.bigExplosion == true
Then
4Burst Particles
Particles
"Big Explosion"
Count
@self.bigExplosionCount
Z Index Offset
2
5Burst Particles
Particles
"Smoke Puff"
Count
@self.bigSmokeCount
Z Index Offset
2
6Control Sound
Sound
"Explosion Large"
7Camera Shake
Intensity
@self.shakeStrength
Seconds
@self.shakeSeconds
8Otherwise
9Burst Particles
Particles
"Plane Explosion"
Count
@self.explosionCount
Z Index Offset
2
10Burst Particles
Particles
"Smoke Puff"
Count
@self.smokeCount
Z Index Offset
2
11Control Sound
Sound
"Explosion Small"
12Destroy Instance

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.

ObjectZero FighterAddDelete
Transform
Bounding Box > SizeX 3, Y 3
Physics > Physics ObjectOff
Sprite
Scene Depth Draw Order20
SpriteZero Fighter Art
Transform > SizeX 3, Y 3
Collider
Shape and Transform > SizeX 1.5, Y 1.125
Tags and Interactions > InteractionsCollide Only With
Tags and Interactions > Collide Only WithFighter, Tagged Fighter Round
Data Structure
Data StructureEnemy Stats
Input SourceData Table
Data TableEnemy Types
Tags
Object TagsEnemy Aircraft
Logic
Zero Fighter Guns
Cast Shadow
Fly Down
Takes Hits
Meter with Thresholds
Shot Down
Drops a Pickup
Remove When Out of View
Shared Variables
changeAmount > KindExpression
changeAmount > ExpressionobjectComponentProperty("self","dataStruct","damage")
maximum > KindExpression
maximum > ExpressionobjectComponentProperty("self","dataStruct","health")
threshold > KindExpression
threshold > ExpressionobjectComponentProperty("self","dataStruct","health")
roundEnemy Round
fighterFighter
shadowZero Fighter Shadow
offsetX0.75
offsetY-1.125

The other three get the same two changes, and your hands know them now.

ObjectRed AceAddDelete
Transform
Bounding Box > SizeX 3, Y 3
Physics > Physics ObjectOff
Sprite
Scene Depth Draw Order21
SpriteRed Ace Art
Transform > SizeX 3, Y 3
Collider
Shape and Transform > SizeX 1.563, Y 1.188
Tags and Interactions > InteractionsCollide Only With
Tags and Interactions > Collide Only WithFighter, Tagged Fighter Round
Data Structure
Data StructureEnemy Stats
Input SourceData Table
Data TableEnemy Types
Tags
Object TagsEnemy Aircraft
Logic
Weave
Red Ace Guns
Cast Shadow
Fly Down
Takes Hits
Meter with Thresholds
Shot Down
Drops a Pickup
Remove When Out of View
Shared Variables
changeAmount > KindExpression
changeAmount > ExpressionobjectComponentProperty("self","dataStruct","damage")
maximum > KindExpression
maximum > ExpressionobjectComponentProperty("self","dataStruct","health")
threshold > KindExpression
threshold > ExpressionobjectComponentProperty("self","dataStruct","health")
shadowRed Ace Shadow
offsetX0.75
offsetY-1.125
roundEnemy Round
fighterFighter
ObjectDive BomberAddDelete
Transform
Bounding Box > SizeX 3, Y 3
Physics > Physics ObjectOff
Sprite
Scene Depth Draw Order22
SpriteDive Bomber Art
Transform > SizeX 3, Y 3
Collider
Shape and Transform > SizeX 1.813, Y 1.375
Tags and Interactions > InteractionsCollide Only With
Tags and Interactions > Collide Only WithFighter, Tagged Fighter Round
Data Structure
Data StructureEnemy Stats
Input SourceData Table
Data TableEnemy Types
Tags
Object TagsEnemy Aircraft
Logic
Dive Attack
Cast Shadow
Fly Down
Takes Hits
Meter with Thresholds
Shot Down
Drops a Pickup
Remove When Out of View
Shared Variables
changeAmount > KindExpression
changeAmount > ExpressionobjectComponentProperty("self","dataStruct","damage")
maximum > KindExpression
maximum > ExpressionobjectComponentProperty("self","dataStruct","health")
threshold > KindExpression
threshold > ExpressionobjectComponentProperty("self","dataStruct","health")
shadowDive Bomber Shadow
offsetX0.844
offsetY-1.219
roundEnemy Round
fighterFighter
ObjectHeavy BomberAddDelete
Transform
Bounding Box > SizeX 3, Y 3
Physics > Physics ObjectOff
Sprite
Scene Depth Draw Order19
SpriteHeavy Bomber Art
Transform > SizeX 3, Y 3
Collider
Shape and Transform > SizeX 2.625, Y 1.875
Tags and Interactions > InteractionsCollide Only With
Tags and Interactions > Collide Only WithFighter, Tagged Fighter Round
Data Structure
Data StructureEnemy Stats
Input SourceData Table
Data TableEnemy Types
Tags
Object TagsEnemy Aircraft
Logic
Heavy Bomber Guns
Cast Shadow
Fly Down
Takes Hits
Meter with Thresholds
Shot Down
Drops a Pickup
Remove When Out of View
Shared Variables
changeAmount > KindExpression
changeAmount > ExpressionobjectComponentProperty("self","dataStruct","damage")
maximum > KindExpression
maximum > ExpressionobjectComponentProperty("self","dataStruct","health")
threshold > KindExpression
threshold > ExpressionobjectComponentProperty("self","dataStruct","health")
shadowHeavy Bomber Shadow
offsetX1.031
offsetY-1.594
roundEnemy Round
fighterFighter

Try 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.

Data TableWeaponsData Structure: Weapons Entry
Row 0Machine Guns
labelMACHINE GUNS
Row 1Spread Shot
labelSPREAD SHOT
Row 2Rapid Guns
labelRAPID GUNS

8.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.

ObjectWeapon Name
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorBottom Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 48
Text / UI
Text{$weaponName}
FontBebas Neue
Font Size24
Letter Spacing1
AlignmentCenter
Text BoundsWrap to Width
Transform > Size X260

8.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.

ObjectSpread Round
Transform
Bounding Box > SizeX 3, Y 3
Sprite
Scene Depth Draw Order35
SpriteSpread Round Art
Transform > SizeX 3, Y 3
Collider
CollisionSensor
Shape and Transform > SizeX 0.375, Y 0.375
Tags and Interactions > InteractionsCollide Only With
Tags and Interactions > Collide Only WithTagged Enemy Aircraft
Tags
Object TagsFighter Round
Logic
Remove When Out of View
Breaks on Hit
ObjectRapid Round
Transform
Bounding Box > SizeX 3, Y 3
Sprite
Scene Depth Draw Order35
SpriteRapid Round Art
Transform > SizeX 3, Y 3
Collider
CollisionSensor
Shape and Transform > SizeX 0.313, Y 0.813
Tags and Interactions > InteractionsCollide Only With
Tags and Interactions > Collide Only WithTagged Enemy Aircraft
Tags
Object TagsFighter Round
Logic
Remove When Out of View
Breaks on Hit

8.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.

FunctionSound the Guns

The gunfire sound and the muzzle flash at the Fighter's nose.

PARAMETERS
NameTypeStarts at
CallerObject
SectionEffects
muzzleFlashCountNumber6
muzzleFlashYNumber1.375
ACTIONS
1Control Sound
Applies To
Caller
Sound
"Fighter Gunfire"
2Burst Particles
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.

Logic ComponentFighter GunsAttach to: FighterAddDelete

While Fire is held, fires the current weapon each time its cooldown is over: Machine Guns, Spread Shot or Rapid Guns (one Mode each).

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
roundObjectConstantNone
roundSpeedNumberConstant32.813
fireRateSecondsNumberConstant0.11
spreadRoundObjectConstantNone
spreadSpeedNumberConstant25.625
spreadRateSecondsNumberConstant0.17
spreadArcPerLevelNumberConstant20
spreadMuzzleYNumberConstant1.25
rapidRoundObjectConstantNone
rapidRateSecondsNumberConstant0.061
muzzleFlashCountNumberConstant6
muzzleFlashYNumberConstant1.375
While Fire Is Held
WhenCommand HeldCommand: Fire
ModeMachine Guns (Starting Mode)
1Check Cooldown Ready
Action Name
machineGunsReady
Cooldown Key
fireRate
2IfmachineGunsReady.value == true
Then
3Start Cooldown
Cooldown Key
fireRate
Seconds
@self.fireRateSeconds
4Control Sound
Sound
"Fighter Gunfire"
5Burst Particles
Particles
"Muzzle Flash"
Y
@self.muzzleFlashY
Count
@self.muzzleFlashCount
Z Index Offset
2
4Sound the GunsFunction
caller
self
5Fire a VolleyFunction
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.

Logic ComponentFighter GunscontinuedAddDelete
While Fire Is Held
WhenCommand HeldCommand: Fire
ModeSpread Shot
1Check Cooldown Ready
Action Name
spreadShotReady
Cooldown Key
fireRate
2IfspreadShotReady.value == true
Then
3Start Cooldown
Cooldown Key
fireRate
Seconds
@self.spreadRateSeconds
4Sound the GunsFunction
caller
self
5Fire a SpreadFunction
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.

Logic ComponentFighter GunscontinuedAddDelete
While Fire Is Held
WhenCommand HeldCommand: Fire
ModeRapid Guns
1Check Cooldown Ready
Action Name
rapidGunsReady
Cooldown Key
fireRate
2IfrapidGunsReady.value == true
Then
3Start Cooldown
Cooldown Key
fireRate
Seconds
@self.rapidRateSeconds
4Sound the GunsFunction
caller
self
5Fire a VolleyFunction
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.

Logic ComponentWeapon PickupsAttach to: Fighter

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.

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
rapidSecondsNumberConstant10
On Spread Shot Collected
WhenspreadShotCollectedCustom Event
1Switch Mode
Event
While Fire Is Held (Fighter Guns)
Mode
Spread Shot
2Change Variable
Variable
$weaponName
Value
data("Weapons", "Spread Shot", "label")
3Stop Recurring Timer
Timer Name
rapidGuns
4Trigger Custom Event
Custom Event
rapidGunsEnded
5Show the RewardFunction
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.

Logic ComponentWeapon Pickupscontinued
On Rapid Guns Collected
WhenrapidGunsCollectedCustom Event
1Switch Mode
Event
While Fire Is Held (Fighter Guns)
Mode
Rapid Guns
2Change Variable
Variable
$weaponName
Value
data("Weapons", "Rapid Guns", "label")
3Start Recurring Timer
Timer Name
rapidGuns
Repeat Every (s)
@self.rapidSeconds
First Delay (s)
@self.rapidSeconds
Ring Once
Yes
4Trigger Custom Event
Custom Event
rapidGunsStarted
5Show the RewardFunction
pickup
other
words
data("Pickups", "Rapid Guns", "popupText")
color
data("Pickups", "Rapid Guns", "popupColor")
On the Rapid Guns Timer
WhenRecurring TimerTimer name: rapidGuns
1Reset Modes
Event
While Fire Is Held (Fighter Guns)
2Change Variable
Variable
$weaponName
Value
data("Weapons", "Machine Guns", "label")
3Trigger Custom Event
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.

ObjectRapid Meter
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorBottom Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order102
SpritePower Pip Art
Transform > SizeX 120, Y 5
Tint (on its placement)#5AC8FF
Logic
Show Rapid Time

8.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.

Logic ComponentShow Rapid TimeAttach to: Rapid Meter

Shows the Rapid Guns meter while Rapid Guns lasts, shrinking to nothing as its time runs out.

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
rapidSecondsNumberConstant10
On Rapid Guns Started
WhenrapidGunsStartedCustom Event
1Set Scale
2Set Visible
Visible
Yes
3Tween
Value
self.transform.scale.x
Target
0
Duration
@self.rapidSeconds
On Rapid Guns Ended
WhenrapidGunsEndedCustom Event
1Set Visible
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.

Particle EffectBomb Shockwave
Emitter
Emission > Emit Every (ms)0
Emission > Burst Count140
Emitter Shape > Emit Radius (m)0.938
Motion
Lifecycle > Each Particle Lives (ms)min 450, max 800
Motion > Speed (m/s)min 16.25, max 21.875
Appearance
Appearance > Particle SpriteFX Smoke Puff
Appearance > Color SourceMultiple Colors
Appearance > Multiple Colors#FFFFFF, #CFEFFF, #7FD4FF
Appearance > Glow1.5
Appearance Over Life > Scalestart 1.2, end 0.2
Appearance Over Life > Alphastart 0.9, end 0

8.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.

Logic ComponentShow BombsAttach to: Bomb Icon

Shows this bomb icon while the Fighter has at least its number of bombs (1 to 5).

Attach toAny Object
PER INSTANCE VARIABLES
NameTypeStarting Value
levelNumber1
When Created
WhenCreate
1Show If At LeastFunction
caller
self
value
$bombs
level
self.level
On Variable Changed · Bombs
WhenVariable ChangedGlobal Variable: bombs
1Show If At LeastFunction
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.

ObjectBomb Icon
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorBottom Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 128
Sprite
Scene Depth Draw Order102
SpriteBomb Icon Art
Transform > SizeX 32, Y 32
Logic
Show Bombs
ObjectBomb Label
Transform
Presentation > SpaceWindow / UI
Presentation > Screen AnchorBottom Center
Presentation > Render LayerUI
Bounding Box > SizeX 128, Y 48
Text / UI
TextBOMBS
FontBebas Neue
Font Size18
Color#FF8A80
Letter Spacing1
AlignmentRight
Text BoundsWrap to Width
Transform > Size X180

Place 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.

Logic ComponentDrops BombsAttach to: Fighter

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.

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
protectSecondsNumberConstant1.2
bombShockwaveCountNumberConstant140
bombExplosionCountNumberConstant40
flashSecondsNumberConstant0.35
bombShakeStrengthNumberConstant0.03
bombShakeSecondsNumberConstant0.6
When Bomb Is Pressed
WhenCommand PressedCommand: Bomb
1Check Game State
Action Name
stillPlaying
Game State
Playing
2IfstillPlaying.value == true && $bombs > 0
Then
3Check Cooldown Ready
Action Name
protectionOver
Cooldown Key
protection
4IfprotectionOver.value == true
Then
5Start ProtectionFunction
caller
self
seconds
@self.protectSeconds
6Burst Particles
Particles
"Bomb Shockwave"
Count
@self.bombShockwaveCount
Z Index Offset
2
7Burst Particles
Particles
"Big Explosion"
Count
@self.bombExplosionCount
Z Index Offset
2
8Control Sound
Sound
"Bomb Blast"
9Camera Flash
Seconds
@self.flashSeconds
10Camera Shake
Intensity
@self.bombShakeStrength
Seconds
@self.bombShakeSeconds
11Trigger Custom Event
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.

Logic ComponentSpend a BombAttach to: Game Rules

Each bomb set off takes one from $bombs.

Attach toAny Object
On Bomb Dropped
WhenbombDroppedCustom Event
1Change Variable
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.

Logic ComponentBreaks on BombAttach to: Enemy Round

An enemy round breaks with a small spark when a bomb goes off.

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
blastSparksCountNumberConstant4
On Bomb Dropped
WhenbombDroppedCustom Event
1Burst Particles
Particles
"Hit Sparks"
Count
@self.blastSparksCount
Z Index Offset
2
2Destroy Instance

Attach Breaks on Bomb to the Enemy Round. Every round the enemies fire is an Enemy Round, so that’s all of them.

ObjectEnemy RoundAddDelete
Transform
Bounding Box > SizeX 3, Y 3
Sprite
Scene Depth Draw Order45
SpriteEnemy Round Art
Transform > SizeX 3, Y 3
Collider
CollisionSensor
Shape and Transform > SizeX 0.313, Y 0.313
Tags and Interactions > InteractionsCollide Only With
Tags and Interactions > Collide Only WithFighter
Tags
Object TagsEnemy Fire
Logic
Remove When Out of View
Breaks on Fighter
Breaks on Bomb

8.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.

Logic ComponentTakes HitsAttach to: Zero Fighter, Red Ace, Dive Bomber, Heavy BomberAddDelete

Each Fighter round that hits counts roundDamage on the enemy's meter and flashes it white for a moment; a bomb counts bombDamage.

Attach toAny Object
DATA STRUCTURES
Enemy Statsself.enemyStats
SHARED VARIABLES
NameTypeKindStarting Value
flashSecondsNumberConstant0.06
roundDamageNumberConstant1
bombDamageNumberConstant25
On Round Hit
WhenroundHitCustom Event
1Change Sprite Tint Property
2Change Sprite Tint Property
Property
Mode
Value
"solid"
3Change Sprite Tint Property
Property
Enabled
Value
true
4Start Recurring Timer
Timer Name
hitFlash
Repeat Every (s)
@self.flashSeconds
First Delay (s)
@self.flashSeconds
Ring Once
Yes
5Change Component Value
Component Value
self.enemyStats.damage
Value
@self.roundDamage
6Trigger Custom Event on Object
Custom Event
changeMeter
On the Hit Flash Timer
WhenRecurring TimerTimer name: hitFlash
1Change Sprite Tint Property
Property
Enabled
Value
false
On Bomb Dropped
WhenbombDroppedCustom Event
1Change Component Value
Component Value
self.enemyStats.damage
Value
@self.bombDamage
2Trigger Custom Event on Object
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.

Logic ComponentMission StartAttach to: Game RulesAddDelete

Sets up a fresh mission each time the Gameplay Scene starts: Playing, score 0, startMedkits medkits, gun level startGunLevel.

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
startMedkitsNumberConstant3
startGunLevelNumberConstant1
startBombsNumberConstant2
When the Scene Starts
WhenScene Start
1Set Game State
Game State
Playing
2Change Variable
Variable
$score
Value
0
3Change Variable
Variable
$medkits
Value
@self.startMedkits
4Change Variable
Variable
$gunLevel
Value
@self.startGunLevel
5Change Variable
Variable
$weaponName
Value
data("Weapons", "Machine Guns", "label")
6Change Variable
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.

Data TableMission TimelineData Structure: Mission Timeline EntryAddDelete
IMPORT CSV54 rows, from a file
FIRST ROWS3 of 54, to compare
IMPORT CSV46 rows, from a file
FIRST ROWS3 of 46, to compare
Row 0Wave 1: V at 3 s
timeSeconds3
formationV
objectZero Fighter
x11.25
count5
spacing2.25
entryY35.9375
Row 1Wave 1: Column (left) at 6.5 s
timeSeconds6.5
formationColumn
objectZero Fighter
x5.3125
count4
spacing2.8125
entryY35.9375
Row 2Wave 1: Column (right) at 6.5 s
timeSeconds6.5
formationColumn
objectZero Fighter
x17.1875
count4
spacing2.8125
entryY35.9375

8.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.

FunctionMake a Row ArriveAddDelete

Makes one Mission Timeline row arrive: the Object its object cell names, in the row's formation (a supply drop: one pickup).

PARAMETERS
NameTypeStarts at
CallerObject
rowNumber0
ACTIONS
1Ifdata("Mission Timeline", row, "formation") == "Supply Drop"
Then
2Create Instance
Applies To
Caller
Object to Create
data("Mission Timeline", row, "object")
X
data("Mission Timeline", row, "x")
Y
data("Mission Timeline", row, "entryY")
3Ifdata("Mission Timeline", row, "formation") == "V"
Then
4Spawn V FormationFunction
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")
5Ifdata("Mission Timeline", row, "formation") == "Column"
Then
6Spawn ColumnFunction
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")
7Ifdata("Mission Timeline", row, "formation") == "Row"
Then
8Spawn RowFunction
caller
Caller
enemy
data("Mission Timeline", row, "object")
count
data("Mission Timeline", row, "count")
entryY
data("Mission Timeline", row, "entryY")
9Ifdata("Mission Timeline", row, "formation") == "Side Sweep"
Then
10Spawn Side SweepFunction
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.

Play it!

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.
How it works

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.

Challenge

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.