Build a GameCreating Pacific Wings

Appendix A — Logic Reference

Every Logic Component and Function in Pacific Wings, as it is in the finished game. Each entry stands on its own: read what it does, see what it needs, and build it from its card into your own game. A card’s Shared Variables and Per Instance Variables are the values you can change. A Shared Variable holds one value for the whole Object, under Variables in its Properties. A Per Instance Variable holds one for each placement in the Scene.

A.1 Vertical Shooter Controls

Comes whole from Myth’s templates. Built in Chapter 1, The Fighter Flies.

Logic ComponentVertical Shooter ControlsAttach to: Fighter

Flies the Fighter: steers it at moveSpeed with the Move Command, carries it and the camera north at scrollSpeed, keeps it inside the camera view (and topSafeInset meters below its top edge), and tilts it bankAngle degrees toward the side it moves to.

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
moveSpeedNumberConstant6.875
scrollSpeedNumberConstant2.813
bankAngleNumberConstant7
topSafeInsetNumberConstant0
Built in: this Logic Component comes whole from the engine's template.
You add it and set its Variables on the Object; you do not build its Events.
Move 2D Axis Input
When2D Axis InputCommand: Move
ModeReturning (no steering)
(no Actions)

A.2 Fighter Guns

Built in Chapter 2, Machine Guns.

Logic ComponentFighter GunsAttach to: Fighter

While Fire is held, fires Fighter Tracers north from the muzzles the weapon level's row in Weapon Levels names, as often as that row says.

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
tracerObjectConstantNone
tracerSpeedNumberConstant17.5
centerFlashParticlesNumberConstant5
wingFlashParticlesNumberConstant4
While Fire Is Held
WhenCommand HeldCommand: Fire
ModeFire the Guns (Starting Mode)
1Check Cooldown Ready
Action Name
fireRateReady
Cooldown Key
"fireRate"
2IffireRateReady.value == true
Then
3Ifdata('Weapon Levels', $weaponLevel, 'centerGun') == true
Then
4Fire From MuzzleFunction
shooter
self
tracer
@self.tracer
muzzle
"Center Muzzle"
tracerSpeed
@self.tracerSpeed
flashParticles
@self.centerFlashParticles
5Ifdata('Weapon Levels', $weaponLevel, 'wingCannons') == true
Then
6Fire From MuzzleFunction
shooter
self
tracer
@self.tracer
muzzle
"Left Muzzle"
tracerSpeed
@self.tracerSpeed
flashParticles
@self.wingFlashParticles
7Fire From MuzzleFunction
shooter
self
tracer
@self.tracer
muzzle
"Right Muzzle"
tracerSpeed
@self.tracerSpeed
flashParticles
@self.wingFlashParticles
8Control Sound
Sound
Machine Guns
9Start Cooldown
Cooldown Key
"fireRate"
Seconds
data('Weapon Levels', $weaponLevel, 'fireRateSeconds')
While Fire Is Held
WhenCommand HeldCommand: Fire
ModeHolding Fire
(no Actions)

A.3 Remove When Out of View

Built in Chapter 2, Machine Guns.

Logic ComponentRemove When Out of ViewAttach to: Fighter Tracer, Enemy Fighter, Enemy Tracer, Enemy Ace, Heavy Bomber, Wing Cannons, Repair Crate

Removes this Object once it has left every camera view.

Attach toAny Object
When Leaving the View
WhenLeave View
1Destroy Instance

A.4 Breaks on Hit

Built in Chapter 3, The First Enemies.

Logic ComponentBreaks on HitAttach to: Fighter Tracer

Removes this tracer when it touches an enemy or the Command Bomber.

Attach toAny Object
When Starting to Hit Anything Tagged Enemy Aircraft
WhenCollision EnterObject: tag:Enemy Aircraft
1Destroy Instance
When Starting to Hit Command Bomber
WhenCollision EnterObject: Command Bomber
1Destroy Instance

A.5 Fly South When Seen

Built in Chapter 3, The First Enemies.

Logic ComponentFly South When SeenAttach to: Enemy Fighter, Enemy Ace, Heavy Bomber, Wing Cannons, Repair Crate

Starts this Object flying south at its speed when it first comes into view.

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
speedNumberConstant3.7
When Entering the View
WhenEnter View
1Set Velocity
Y Velocity
-@self.speed

A.6 Score

Built in Chapter 3, The First Enemies.

Logic ComponentScoreAttach to: Game Rules

Adds the points of every enemy shot down (times the kill-chain multiplier), of every pickup collected, and of every hit on and the shoot-down of the Command Bomber, to $score, until the mission ends.

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
wingCannonsPointsNumberConstant250
repairCratePointsNumberConstant100
commandBomberHitPointsNumberConstant10
commandBomberPointsNumberConstant2000
On Enemy Shot Down
WhenenemyShotDownCustom Event
1Declare Variable
Name
multiplier
Value
1
2Change Variable
Variable
multiplier
Value
data('Kill Chain Multipliers', $chainRow, 'multiplier')
3Change Variable
Variable
$score
Operator
+=
Value
other.enemyStats.points * multiplier
4Trigger Custom Event on Object
Custom Event
shotDownScored
On Game State Changed
WhenGame State Changed
1Ifevent.current == "mission-failed" || event.current == "mission-complete"
Then
2Set Logic State
Logic Component
Score
State
Disable
On Wing Cannons Collected
WhenwingCannonsCollectedCustom Event
1Change Variable
Variable
$score
Operator
+=
Value
@self.wingCannonsPoints
On Repair Crate Collected
WhenrepairCrateCollectedCustom Event
1Change Variable
Variable
$score
Operator
+=
Value
@self.repairCratePoints
On Command Bomber Hit
WhencommandBomberHitCustom Event
1Change Variable
Variable
$score
Operator
+=
Value
@self.commandBomberHitPoints
On Command Bomber Shot Down
WhencommandBomberShotDownCustom Event
1Change Variable
Variable
$score
Operator
+=
Value
@self.commandBomberPoints
2Trigger Custom Event on Object
Custom Event
commandBomberScored

A.7 Shot Down

Built in Chapter 3, The First Enemies.

Logic ComponentShot DownAttach to: Enemy Fighter, Enemy Ace, Heavy Bomber

When this enemy has no health left, reports enemyShotDown to Game Rules and shotDown to itself, then explodes and is removed.

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
explosionParticlesNumberConstant42
On No More Health
WhennoMoreHealthCustom Event
1Trigger Custom Event
Custom Event
enemyShotDown
2Trigger Custom Event on Object
Custom Event
shotDown
3Control Sound
Sound
Plane Break
4Burst Particles
Particles
Plane Explosion
Count
@self.explosionParticles
Z Index Offset
2
5Destroy Instance

A.8 Takes Hits

Built in Chapter 3, The First Enemies.

Logic ComponentTakes HitsAttach to: Enemy Fighter, Enemy Ace, Heavy Bomber

Each Fighter Tracer that hits takes one health and flashes the enemy white.

Attach toAny Object
DATA STRUCTURES
Enemy Statsself.enemyStats
SHARED VARIABLES
NameTypeKindStarting Value
flashColorColorConstant#ffffff
damageTintColorConstant#ffd0b8
flashSecondsNumberConstant0.07
hitParticlesNumberConstant10
When Starting to Hit Fighter Tracer
WhenCollision EnterObject: Fighter Tracer
1Change Component Value
Component Value
self.enemyStats.health
Operator
-=
Value
1
2Burst Particles
Particles
Flak Burst
Count
@self.hitParticles
Z Index Offset
2
3Flash on HitFunction
target
self
flashColor
@self.flashColor
flashSeconds
@self.flashSeconds
settleTint
@self.damageTint

A.9 Tint Sprite (Function)

Built in Chapter 3, The First Enemies.

FunctionTint Sprite

Tints the target's sprite: color and mode ("multiply" colors the art, "solid" paints every visible pixel).

PARAMETERS
NameTypeStarts at
targetObject
colorColor#ffffff
modeTextmultiply
ACTIONS
1Change Sprite Tint Property
Applies to
target
Value
color
2Change Sprite Tint Property
Applies to
target
Property
Mode
Value
mode
3Change Sprite Tint Property
Applies to
target
Property
Enabled
Value
true

A.10 Crashes Into Fighter

Built in Chapter 4, Enemy Fire and Lost Planes.

Logic ComponentCrashes Into FighterAttach to: Enemy Fighter, Enemy Tracer, Enemy Ace, Heavy Bomber

Destroys this Object with a flak burst when it touches the Fighter.

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
crashParticlesNumberConstant30
When Starting to Hit Fighter
WhenCollision EnterObject: Fighter
1Burst Particles
Particles
Flak Burst
Count
@self.crashParticles
Z Index Offset
2
2Destroy Instance

A.11 Fire From Muzzle (Function)

Built in Chapter 4, Enemy Fire and Lost Planes.

FunctionFire From Muzzle

The shooter creates one tracer at its muzzle Coordinate, flying in direction at tracerSpeed and turned to face that way, with a muzzle flash.

PARAMETERS
NameTypeStarts at
shooterObject
tracerObject
muzzleTextCenter Muzzle
tracerSpeedNumber17.5
flashParticlesNumber5
directionNumber90
flashThing ParticleGun Muzzle
ACTIONS
1Create Instance
Applies to
shooter
Object to Create
tracer
Position Relative To
Self
Self Position
Coordinate
Coordinate
muzzle
Launch Speed
tracerSpeed
Launch Angle
direction
2Set Rotation
Applies to
created
Degrees
direction - 90
3Burst Particles
Applies to
shooter
Particles
flash
Position Relative To
Coordinate
Coordinate
muzzle
Count
flashParticles
Z Index Offset
2

A.12 Fire When Seen

Built in Chapter 4, Enemy Fire and Lost Planes.

Logic ComponentFire When SeenAttach to: Enemy Fighter, Enemy Ace, Heavy Bomber

Once in view, fires its tracer from the Gun Muzzle toward the Fighter (kept within aimConeDegrees of south; 0 fires straight south), after firstShotSeconds and then every shotSecondsMin to shotSecondsMax seconds.

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
tracerObjectConstantNone
tracerSpeedNumberConstant7.7
firstShotSecondsNumberConstant1.15
shotSecondsMinNumberConstant1.4
shotSecondsMaxNumberConstant2.5
muzzleFlashParticlesNumberConstant5
fighterObjectConstantNone
aimConeDegreesNumberConstant0
minimumForwardMetersNumberConstant2.8
When Entering the View
WhenEnter View
1Start Recurring Timer
Timer Name
"enemyFire"
Repeat Every (s)
@self.firstShotSeconds
Ring Once
Yes
On the Enemy Fire Timer
WhenRecurring TimerTimer name: enemyFire
1Aim at FighterFunction
Action Name
aim
shooter
self
fighter
@self.fighter
minimumForwardMeters
@self.minimumForwardMeters
aimConeDegrees
@self.aimConeDegrees
2Fire From MuzzleFunction
shooter
self
tracer
@self.tracer
muzzle
"Gun Muzzle"
tracerSpeed
@self.tracerSpeed
flashParticles
@self.muzzleFlashParticles
direction
aim.value
flash
'Enemy Gun Muzzle'
3Control Sound
Sound
Enemy Guns
4Generate Random Number
Action Name
nextShotSeconds
Minimum
@self.shotSecondsMin
Maximum
@self.shotSecondsMax
5Start Recurring Timer
Timer Name
"enemyFire"
Repeat Every (s)
nextShotSeconds.value
Ring Once
Yes

A.13 Lost on Hit

Built in Chapter 4, Enemy Fire and Lost Planes.

Logic ComponentLost on HitAttach to: Fighter

When a Fighter Hazard touches the Fighter, the Fighter is lost: it explodes and reports fighterLost (before the Command Bomber's stage the screen also flashes). When its round is over (roundOver, from Rounds), it turns itself off, so nothing can lose the Fighter after the win or while the screen fades to the next round.

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
explosionParticlesNumberConstant88
shakeIntensityNumberConstant0.032
shakeSecondsNumberConstant0.48
flashColorColorConstant#fff1bd
flashSecondsNumberConstant0.16
flashBeforeStageNumberConstant4
When Starting to Hit Anything Tagged Fighter Hazard
WhenCollision EnterObject: tag:Fighter Hazard
ModeLost (Starting Mode)
1Trigger Custom Event
Custom Event
fighterLost
2Control Sound
Sound
Fighter Lost
3Camera Shake
Intensity
@self.shakeIntensity
Seconds
@self.shakeSeconds
4If$stage < @self.flashBeforeStage
Then
5Camera Flash
Color
@self.flashColor
Seconds
@self.flashSeconds
6Burst Particles
Particles
Plane Explosion
Count
@self.explosionParticles
Z Index Offset
2
7Destroy Instance
When Starting to Hit Anything Tagged Fighter Hazard
WhenCollision EnterObject: tag:Fighter Hazard
ModeProtected
(no Actions)
On Round Over
WhenroundOverCustom Event
1Set Logic State
Logic Component
Lost on Hit
State
Disable

A.14 Match Icon to Planes (Function)

Built in Chapter 4, Enemy Fire and Lost Planes.

FunctionMatch Icon to Planes

Shows the icon while more than slot planes are left, and hides it otherwise (the plane flying is not in reserve).

PARAMETERS
NameTypeStarts at
iconObject
slotNumber1
ACTIONS
1If$planes > slot
Then
2Set Alpha
Applies to
icon
3Otherwise
4Set Alpha
Applies to
icon
Alpha
0

A.15 Planes

Built in Chapter 4, Enemy Fire and Lost Planes.

Logic ComponentPlanesAttach to: Game Rules

Counts the planes left; after a loss, launches a reserve plane if one is left; a Repair Crate adds one (up to maximumPlanes).

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
fighterObjectConstantNone
startingPlanesNumberConstant3
reserveDelaySecondsNumberConstant2
reserveStartBelowMiddleNumberConstant17.5
maximumPlanesNumberConstant6
When the Game Starts
WhenGame Start
1Change Variable
Variable
$planes
Value
@self.startingPlanes
On Fighter Lost
WhenfighterLostCustom Event
1Check Game State
Action Name
isPlaying
Game State
Playing
2IfisPlaying.value == true
Then
3Change Variable
Variable
$planes
Operator
-=
Value
1
4If$planes > 0
Then
5Start Recurring Timer
Timer Name
"launchReserve"
Repeat Every (s)
@self.reserveDelaySeconds
Ring Once
Yes
6Otherwise
7Set Game State
Game State
Mission Failed
On the Launch Reserve Timer
WhenRecurring TimerTimer name: launchReserve
1Create Instance
Object to Create
@self.fighter
X
$viewMiddleX
Y
$viewMiddleY - @self.reserveStartBelowMiddle
2Trigger Custom Event on Object
Applies to
created
Custom Event
startReturnFlight
3Control Sound
Sound
Reserve Plane Arrives
On Repair Crate Collected
WhenrepairCrateCollectedCustom Event
1If$planes < @self.maximumPlanes
Then
2Change Variable
Variable
$planes
Operator
+=
Value
1

A.16 Return Flight

Built in Chapter 4, Enemy Fire and Lost Planes.

Logic ComponentReturn FlightAttach to: Fighter

Flies a reserve plane up from below the screen to the middle (under the Command Bomber's lane while it is on screen; if the lane closes during the flight, it flies in again, under the lane), protected and blinking, then gives back its controls and guns.

Attach toAny Object
DATA STRUCTURES
Return Flight Dataself.returnFlightData
SHARED VARIABLES
NameTypeKindStarting Value
returnSecondsNumberConstant1.2
protectionSecondsNumberConstant2
belowLaneMetersNumberConstant2.5
blinkSecondsNumberConstant0.1
dimAlphaNumberConstant0.25
On Start Return Flight
WhenstartReturnFlightCustom Event
1Declare Variable
Name
belowLaneY
Value
0
2Declare Variable
Name
viewTopY
Value
0
3Declare Variable
Name
arrivalY
Value
0
4Switch Mode
Event
Move 2D Axis Input · Fighter
Mode
Returning (no steering)
5Switch Mode
Event
While Fire Is Held · Fighter
Mode
Holding Fire
6Switch Mode
Event
When Starting to Hit Anything Tagged Fighter Hazard · Fighter
Mode
Protected
7Change Variable
Variable
arrivalY
Value
$viewMiddleY + $scrollSpeed * @self.returnSeconds
8Change Variable
Variable
viewTopY
Value
arrivalY + $viewHeight / 2
9Change Variable
Variable
belowLaneY
Value
viewTopY - $bomberLaneMeters - @self.belowLaneMeters
10IfbelowLaneY < arrivalY
Then
11Change Variable
Variable
arrivalY
Value
belowLaneY
12Change Component Value
Component Value
self.returnFlightData.laneMetersWhenAimed
Value
$bomberLaneMeters
13Tween Property
Property
Y
Target Value
arrivalY
Seconds
@self.returnSeconds
Ease
Smooth
14Start Recurring Timer
Timer Name
"arrived"
Repeat Every (s)
@self.returnSeconds
Ring Once
Yes
15Start Recurring Timer
Timer Name
"protectionOver"
Repeat Every (s)
@self.returnSeconds + @self.protectionSeconds
Ring Once
Yes
16Start Recurring Timer
Timer Name
"blink"
Repeat Every (s)
@self.blinkSeconds
On the Arrived Timer
WhenRecurring TimerTimer name: arrived
1If$bomberLaneMeters > self.returnFlightData.laneMetersWhenAimed
Then
2Trigger Custom Event on Object
Custom Event
startReturnFlight
3Otherwise
4Switch Mode
Event
Move 2D Axis Input · Fighter
Mode
Vertical Shooter Controls
5Switch Mode
Event
While Fire Is Held · Fighter
Mode
Fire the Guns
On the Protection Over Timer
WhenRecurring TimerTimer name: protectionOver
1Switch Mode
Event
When Starting to Hit Anything Tagged Fighter Hazard · Fighter
Mode
Lost
2Stop Recurring Timer
Timer Name
"blink"
3Change Component Value
Component Value
self.returnFlightData.isDimmed
Value
false
4Set Alpha
On the Blink Timer
WhenRecurring TimerTimer name: blink
1Ifself.returnFlightData.isDimmed == true
Then
2Change Component Value
Component Value
self.returnFlightData.isDimmed
Value
false
3Set Alpha
4Otherwise
5Change Component Value
Component Value
self.returnFlightData.isDimmed
Value
true
6Set Alpha
Alpha
@self.dimAlpha

A.17 Show While in Reserve

Built in Chapter 4, Enemy Fire and Lost Planes.

Logic ComponentShow While in ReserveAttach to: Reserve Plane Icon

Shows this icon only while the reserve plane it stands for is left.

Attach toAny Object
PER INSTANCE VARIABLES
NameTypeStarting Value
slotNumber1
When Created
WhenCreate
1Match Icon to PlanesFunction
icon
self
slot
self.slot
On Variable Changed · Planes
WhenVariable ChangedGlobal Variable: planes
1Match Icon to PlanesFunction
icon
self
slot
self.slot

A.18 Track the View

Built in Chapter 4, Enemy Fire and Lost Planes.

Logic ComponentTrack the View

Runs on the Main Camera. Each Begin Step it writes where the view is, in Globals that Logic on other Objects reads to place planes, enemies, pickups and scenery relative to the view.

Attach toCamera
On Begin Step
WhenBegin Step
1Change Variable
Variable
$viewMiddleX
Value
self.transform.position.x
2Change Variable
Variable
$viewMiddleY
Value
self.transform.position.y
3Change Variable
Variable
$viewHeight
Value
self.camera.viewport.height

A.19 Best Score

Built in Chapter 5, Title, Pause and Play Again.

Logic ComponentBest ScoreAttach to: Game Rules

Keeps the best score on this device: shows it on the title screen and raises it when a mission ends.

Attach toAny Object
When the Game Starts
WhenGame Start
1Load Persistent Value
Action Name
savedBest
Key
"bestScore"
Default
0
2Change Variable
Variable
$bestScore
Value
savedBest.value
3If$bestScore > 0
Then
4Set UI Group Visibility
UI Group
"best"
On Start Mission
WhenstartMissionCustom Event
1Set UI Group Visibility
UI Group
"best"
Visible
No
On Game State Changed
WhenGame State Changed
1Ifevent.current == "mission-failed" || event.current == "mission-complete"
Then
2If$score > $bestScore
Then
3Change Variable
Variable
$bestScore
Value
$score
4Save Persistent Value
Action Name
bestSaved
Key
"bestScore"
Value
$bestScore

A.20 Mission Start

Built in Chapter 5, Title, Pause and Play Again.

Logic ComponentMission StartAttach to: Game Rules

Shows the title screen when the game begins, and starts the mission when START MISSION is chosen.

Attach toAny Object
When the Game Starts
WhenGame Start
1Control Menu
Menu Element
Start Menu
2Set Menu Pause State
Menu Element
Start Menu
On Start Mission
WhenstartMissionCustom Event
1Set Game State
Game State
Playing
2Control Menu
Operation
Hide
Menu Element
Start Menu

A.21 Pause

Built in Chapter 5, Title, Pause and Play Again.

Logic ComponentPauseAttach to: Game Rules

Esc pauses the world while a mission is being played; RESUME (or Esc, or Enter) carries on. When a round is over (roundOver, from Rounds), it turns itself off: the fade to the next round cannot be paused.

Attach toAny Object
When Menu Cancel Is Pressed
WhenCommand PressedCommand: Menu Cancel
1Check Game State
Action Name
isPlaying
Game State
Playing
2IfisPlaying.value == true
Then
3Control Menu
Menu Element
Pause Menu
4Set Menu Pause State
Menu Element
Pause Menu
On Resume Mission
WhenresumeMissionCustom Event
1Set Menu Pause State
Menu Element
Pause Menu
Pause the World
No
2Control Menu
Operation
Hide
Menu Element
Pause Menu
On Round Over
WhenroundOverCustom Event
1Trigger Custom Event on Object
Custom Event
resumeMission
2Set Logic State
Logic Component
Pause
State
Disable

A.22 Play Again

Built in Chapter 5, Title, Pause and Play Again.

Logic ComponentPlay AgainAttach to: Game Rules

Restarts the whole game when PLAY AGAIN is chosen.

Attach toAny Object
On Play Again
WhenplayAgainCustom Event
1Restart Game

A.23 Show the Flight HUD

Built in Chapter 5, Title, Pause and Play Again.

Logic ComponentShow the Flight HUDAttach to: Score Text

Shows the flight HUD (SCORE and the reserve plane icons) while the mission is being played, and hides it, with the Command Bomber's health bar, when the mission ends.

Attach toAny Object
On Game State Changed
WhenGame State Changed
1Ifevent.current == "playing"
Then
2Set UI Group Visibility
UI Group
"flight"
3Otherwise
4Set UI Group Visibility
UI Group
"flight"
Visible
No
5Set UI Group Visibility
UI Group
"commandBomber"
Visible
No

A.24 Weave

Built in Chapter 6, Aces and Heavy Bombers.

Logic ComponentWeaveAttach to: Enemy Ace, Heavy Bomber, Command Bomber

Once in view, slides from side to side around where it came into view, turning every weaveSeconds and banking weaveAngle degrees into each turn.

Attach toAny Object
DATA STRUCTURES
Weave Dataself.weaveData
SHARED VARIABLES
NameTypeKindStarting Value
weaveSpeedNumberConstant3.5
weaveSecondsNumberConstant0.68
weaveAngleNumberConstant6
When Entering the View
WhenEnter View
1Trigger Custom Event on Object
Custom Event
weaveTurn
2Start Recurring Timer
Timer Name
"weave"
Repeat Every (s)
@self.weaveSeconds
First Delay (s)
@self.weaveSeconds / 2
On the Weave Timer
WhenRecurring TimerTimer name: weave
1Trigger Custom Event on Object
Custom Event
weaveTurn
On Weave Turn
WhenweaveTurnCustom Event
1Change Component Value
Component Value
self.weaveData.weaveSide
Operator
*=
Value
-1
2Set Velocity
X Velocity
@self.weaveSpeed * self.weaveData.weaveSide
3Set Rotation
Degrees
@self.weaveAngle * self.weaveData.weaveSide

A.25 Drift Sideways

Built in Chapter 7, The Route.

Logic ComponentDrift SidewaysAttach to: Cloud Bank

Drifts sideways at driftSpeed between leftX and rightX, turning back at each on the driftTurn timer. It starts at Create and again whenever the Object is moved ahead.

Attach toAny Object
DATA STRUCTURES
Drift Sideways Dataself.driftSidewaysData
SHARED VARIABLES
NameTypeKindStarting Value
driftSpeedNumberConstant0.4
leftXNumberConstant3.1
rightXNumberConstant16.9
When Created
WhenCreate
1Trigger Custom Event on Object
Custom Event
startDrifting
On Moved Ahead
WhenmovedAheadCustom Event
1Trigger Custom Event on Object
Custom Event
startDrifting
On Start Drifting
WhenstartDriftingCustom Event
1Ifself.transform.position.x < ((@self.leftX + @self.rightX) / 2)
Then
2Change Component Value
Component Value
self.driftSidewaysData.driftSide
Value
1
3Change Component Value
Component Value
self.driftSidewaysData.distanceToGo
Value
@self.rightX - self.transform.position.x
4Otherwise
5Change Component Value
Component Value
self.driftSidewaysData.driftSide
Value
-1
6Change Component Value
Component Value
self.driftSidewaysData.distanceToGo
Value
self.transform.position.x - @self.leftX
7Set Velocity
X Velocity
@self.driftSpeed * self.driftSidewaysData.driftSide
8Start Recurring Timer
Timer Name
"driftTurn"
Repeat Every (s)
(@self.rightX - @self.leftX) / @self.driftSpeed
First Delay (s)
self.driftSidewaysData.distanceToGo / @self.driftSpeed
On the Drift Turn Timer
WhenRecurring TimerTimer name: driftTurn
1Change Component Value
Component Value
self.driftSidewaysData.driftSide
Operator
*=
Value
-1
2Set Velocity
X Velocity
@self.driftSpeed * self.driftSidewaysData.driftSide

A.26 Move Ahead When Passed

Built in Chapter 7, The Route.

Logic ComponentMove Ahead When PassedAttach to: Aircraft Carrier, Tropical Atoll, Coral Reef, Cloud Bank

When this piece of scenery has passed below the view, moves it ahead again: gapMin to gapMax meters beyond the scenery furthest ahead, and at least leadMeters above the middle of the view.

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
leadMetersNumberConstant17.5
gapMinNumberConstant10.6
gapMaxNumberConstant13.1
xMinNumberConstant4.4
xMaxNumberConstant15.6
When Leaving the View
WhenLeave View
1Declare Variable
Name
leadY
Value
0
2Change Variable
Variable
leadY
Value
$viewMiddleY + @self.leadMeters
3If$furthestSceneryY < leadY
Then
4Change Variable
Variable
$furthestSceneryY
Value
leadY
5Generate Random Number
Action Name
gap
Minimum
@self.gapMin
Maximum
@self.gapMax
6Change Variable
Variable
$furthestSceneryY
Operator
+=
Value
gap.value
7Generate Random Number
Action Name
newX
Minimum
@self.xMin
Maximum
@self.xMax
8Set Position
X
newX.value
Y
$furthestSceneryY
9Trigger Custom Event on Object
Custom Event
movedAhead

A.27 Reinforcements

Built in Chapter 7, The Route.

Logic ComponentReinforcementsAttach to: Squadron

Sends one enemy kind in from above the view on the reinforcements timer, from the stage in its Reinforcement Orders row until the Command Bomber approaches; each one only while fewer than cap of that kind are alive.

Attach toAny Object
DATA STRUCTURES
Reinforcements Dataself.reinforcementsData
SHARED VARIABLES
NameTypeKindStarting Value
aboveCameraMetersNumberConstant11.25
PER INSTANCE VARIABLES
NameTypeStarting Value
kindTextEnemy Fighter
On Stage Reached
WhenstageReachedCustom Event
1If$stage == data('Reinforcement Orders', self.kind, 'fromStage')
Then
2Start Recurring Timer
Timer Name
"reinforcements"
Repeat Every (s)
data('Reinforcement Orders', self.kind, 'firstSeconds')
Ring Once
Yes
On the Reinforcements Timer
WhenRecurring TimerTimer name: reinforcements
1Declare Variable
Name
waitSeconds
Value
0
2Repeatdata('Reinforcement Orders', self.kind, 'perWave')times
Each time
3Check Instance Count
Action Name
roomForMore
Object
self.kind
Operator
<
Value
data('Reinforcement Orders', self.kind, 'cap')
4IfroomForMore.value == true
Then
5Generate Random Number
Action Name
laneRoll
Minimum
data('Reinforcement Orders', self.kind, 'xMin')
Maximum
data('Reinforcement Orders', self.kind, 'xMax')
6Change Component Value
Component Value
self.reinforcementsData.laneX
Value
laneRoll.value
7Change Component Value
Component Value
self.reinforcementsData.laneX
Operator
+=
Value
local.index * data('Reinforcement Orders', self.kind, 'laneStepMeters')
8Change Component Value
Component Value
self.reinforcementsData.launchSpeed
Value
data('Enemy Types', self.kind, 'speed')
9Change Component Value
Component Value
self.reinforcementsData.launchSpeed
Operator
*=
Value
data('Round Settings', $roundRow, 'enemySpeed')
10Create Instance
Object to Create
self.kind
X
self.reinforcementsData.laneX
Y
$viewMiddleY + @self.aboveCameraMeters
Launch Speed
self.reinforcementsData.launchSpeed
Launch Angle
-90
11Generate Random Number
Action Name
waitRoll
Minimum
data('Reinforcement Orders', self.kind, 'secondsMin')
Maximum
data('Reinforcement Orders', self.kind, 'secondsMax')
12Change Variable
Variable
waitSeconds
Value
waitRoll.value
13Change Variable
Variable
waitSeconds
Operator
*=
Value
data('Round Settings', $roundRow, 'enemyPace')
14Start Recurring Timer
Timer Name
"reinforcements"
Repeat Every (s)
waitSeconds
Ring Once
Yes
On Command Bomber Approaching
WhencommandBomberApproachingCustom Event
1Stop Recurring Timer
Timer Name
"reinforcements"

A.28 Report Milestone

Built in Chapter 7, The Route.

Logic ComponentReport MilestoneAttach to: Milestone

A marker placed along the route: when it comes into view it tells Game Rules milestoneReached, then removes itself.

Attach toAny Object
When Created
WhenCreate
1Set Alpha
Alpha
0
When Entering the View
WhenEnter View
1Trigger Custom Event
Custom Event
milestoneReached
2Destroy Instance

A.29 Stages

Built in Chapter 7, The Route.

Logic ComponentStagesAttach to: Game Rules

Starts $stage at 1 when the route begins and raises it by one at each milestone, announcing stageReached each time; when no milestones are left it shakes the camera lightly and announces commandBomberApproaching.

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
milestoneObjectConstantNone
shakeIntensityNumberConstant0.012
shakeSecondsNumberConstant0.35
When the Scene Starts
WhenScene Start
1Change Variable
Variable
$stage
Value
1
2Trigger Custom Event
Custom Event
stageReached
On Milestone Reached
WhenmilestoneReachedCustom Event
1Change Variable
Variable
$stage
Operator
+=
Value
1
2Trigger Custom Event
Custom Event
stageReached
On No Instances Left · Milestone
WhenNo Instances LeftObject: Milestone
1Camera Shake
Intensity
@self.shakeIntensity
Seconds
@self.shakeSeconds
2Trigger Custom Event
Custom Event
commandBomberApproaching

A.30 Collected by Fighter

Built in Chapter 8, Pickups and Weapon Levels.

Logic ComponentCollected by FighterAttach to: Wing Cannons, Repair Crate

When the Fighter touches this pickup, sends collectedEvent, plays its sound and sparkle, and removes the pickup.

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
collectedEventTextConstantwingCannonsCollected
soundSoundConstantPower Up
sparkleParticlesConstantPickup Shine
sparkleParticlesNumberConstant42
When Starting to Hit Fighter
WhenCollision EnterObject: Fighter
1Trigger Custom Event
Custom Event
@self.collectedEvent
2Control Sound
Sound
@self.sound
3Burst Particles
Particles
@self.sparkle
Count
@self.sparkleParticles
Z Index Offset
2
4Destroy Instance

A.31 Drop Supply (Function)

Built in Chapter 8, Pickups and Weapon Levels.

FunctionDrop Supply

By chance, and only while none of that pickup is in the sky, the creator drops the pickup aheadMeters north of the Fighter (or of the middle of the view while no Fighter is flying), at a random x.

PARAMETERS
NameTypeStarts at
creatorObject
pickupObject
fighterObjectFighter
chanceNumber0.5
aheadMetersNumber8.4
xMinNumber3.1
xMaxNumber16.9
ACTIONS
1Declare Variable
Name
aheadOfY
Value
0
2Check Instance Count
Action Name
noneInSky
Object
pickup
Operator
<
3Generate Random Number
Action Name
dropRoll
Minimum
0
Maximum
1
4IfnoneInSky.value == true && dropRoll.value < chance
Then
5Check Instance Count
Action Name
fighterInSky
Object
fighter
Operator
>
Value
0
6IffighterInSky.value == true
Then
7Change Variable
Variable
aheadOfY
Value
fighter.transform.position.y
8Otherwise
9Change Variable
Variable
aheadOfY
Value
$viewMiddleY
10Generate Random Number
Action Name
dropX
Minimum
xMin
Maximum
xMax
11Create Instance
Applies to
creator
Object to Create
pickup
X
dropX.value
Y
aheadOfY + aheadMeters

A.32 Drops Pickups

Built in Chapter 8, Pickups and Weapon Levels.

Logic ComponentDrops PickupsAttach to: Enemy Fighter, Enemy Ace, Heavy Bomber

When this enemy is shot down, it may drop a Wing Cannons or a Repair Crate where it is, by its drop chances.

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
wingCannonsObjectConstantNone
repairCrateObjectConstantNone
wingCannonsChanceNumberConstant0
repairCrateChanceNumberConstant0
On Shot Down
WhenshotDownCustom Event
1Generate Random Number
Action Name
wingCannonsRoll
Minimum
0
Maximum
1
2IfwingCannonsRoll.value < @self.wingCannonsChance
Then
3Create Instance
Object to Create
@self.wingCannons
Position Relative To
Self
4Generate Random Number
Action Name
repairCrateRoll
Minimum
0
Maximum
1
5IfrepairCrateRoll.value < @self.repairCrateChance
Then
6Create Instance
Object to Create
@self.repairCrate
Position Relative To
Self
Created As
created2

A.33 Spin

Built in Chapter 8, Pickups and Weapon Levels.

Logic ComponentSpinAttach to: Wing Cannons

Turns this Object steadily at spinDegreesPerSecond from the moment it exists.

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
spinDegreesPerSecondNumberConstant-96
When Created
WhenCreate
1Set Spin
Spin
@self.spinDegreesPerSecond

A.34 Supply Drops

Built in Chapter 8, Pickups and Weapon Levels.

Logic ComponentSupply DropsAttach to: Game Rules

Every secondsMin to secondsMax seconds (the first after firstSeconds), may drop a Wing Cannons and a Repair Crate ahead of the Fighter, until the Command Bomber approaches.

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
wingCannonsObjectConstantNone
repairCrateObjectConstantNone
fighterObjectConstantNone
firstSecondsNumberConstant9.5
secondsMinNumberConstant10
secondsMaxNumberConstant14
wingCannonsChanceNumberConstant0.7
repairCrateChanceNumberConstant0.32
wingCannonsAheadMetersNumberConstant8.4
repairCrateAheadMetersNumberConstant8.9
xMinNumberConstant3.1
xMaxNumberConstant16.9
When the Scene Starts
WhenScene Start
1Start Recurring Timer
Timer Name
"supplyDrop"
Repeat Every (s)
@self.firstSeconds
Ring Once
Yes
On the Supply Drop Timer
WhenRecurring TimerTimer name: supplyDrop
1Drop SupplyFunction
creator
self
pickup
@self.wingCannons
fighter
@self.fighter
chance
@self.wingCannonsChance
aheadMeters
@self.wingCannonsAheadMeters
xMin
@self.xMin
xMax
@self.xMax
2Drop SupplyFunction
creator
self
pickup
@self.repairCrate
fighter
@self.fighter
chance
@self.repairCrateChance
aheadMeters
@self.repairCrateAheadMeters
xMin
@self.xMin
xMax
@self.xMax
3Generate Random Number
Action Name
waitRoll
Minimum
@self.secondsMin
Maximum
@self.secondsMax
4Start Recurring Timer
Timer Name
"supplyDrop"
Repeat Every (s)
waitRoll.value
Ring Once
Yes
On Command Bomber Approaching
WhencommandBomberApproachingCustom Event
1Stop Recurring Timer
Timer Name
"supplyDrop"

A.35 Weapon Level

Built in Chapter 8, Pickups and Weapon Levels.

Logic ComponentWeapon LevelAttach to: Game Rules

Raises $weaponLevel by one for each Wing Cannons collected (up to the last row of Weapon Levels) and lowers it by one for each plane lost.

Attach toAny Object
On Wing Cannons Collected
WhenwingCannonsCollectedCustom Event
1If$weaponLevel < (dataCount('Weapon Levels') - 1)
Then
2Change Variable
Variable
$weaponLevel
Operator
+=
Value
1
On Fighter Lost
WhenfighterLostCustom Event
1If$weaponLevel > 0
Then
2Change Variable
Variable
$weaponLevel
Operator
-=
Value
1

A.36 Kill Chain

Built in Chapter 9, Kill Chain.

Logic ComponentKill ChainAttach to: Game Rules

Each shoot-down moves $chainRow, the kill chain's row of the Kill Chain Multipliers table, to the next row (up to the last); chainSeconds after the last shoot-down it goes back to the first row.

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
chainSecondsNumberConstant1.5
On Shot Down Scored
WhenshotDownScoredCustom Event
1If$chainRow < (dataCount('Kill Chain Multipliers') - 1)
Then
2Change Variable
Variable
$chainRow
Operator
+=
Value
1
3Start Recurring Timer
Timer Name
"killChain"
Repeat Every (s)
@self.chainSeconds
Ring Once
Yes
On the Kill Chain Timer
WhenRecurring TimerTimer name: killChain
1Change Variable
Variable
$chainRow
Value
0

A.37 Kill Chain Color

Built in Chapter 9, Kill Chain.

Logic ComponentKill Chain ColorAttach to: Score Text

Colors this text by the kill chain: the scoreColor of the chain's row of the Kill Chain Multipliers table.

Attach toAny Object
COMPONENTS
self.textText / UI
On Variable Changed · Chain Row
WhenVariable ChangedGlobal Variable: chainRow
1Change Component Value
Component Value
self.text.color
Value
data('Kill Chain Multipliers', $chainRow, 'scoreColor')

A.38 Focus

Built in Chapter 10, Focus.

Logic ComponentFocusAttach to: Fighter

Sets moveSpeed, the Fighter's steering speed, at the start of every step: focusSpeedFactor of normalSpeed if the Focus Command was held in the step before, normalSpeed otherwise.

Attach toAny Object
DATA STRUCTURES
Focus Dataself.focusData
SHARED VARIABLES
NameTypeKindStarting Value
normalSpeedNumberConstant7.8
focusSpeedFactorNumberConstant0.45
moveSpeedNumberChangeable7.8
On Begin Step
WhenBegin Step
1Ifself.focusData.isFocusHeld == true
Then
2Change Variable
Scope
Shared
Object
self
Variable
moveSpeed
Value
@self.normalSpeed * @self.focusSpeedFactor
3Otherwise
4Change Variable
Scope
Shared
Object
self
Variable
moveSpeed
Value
@self.normalSpeed
5Change Component Value
Component Value
self.focusData.isFocusHeld
Value
false
While Focus Is Held
WhenCommand HeldCommand: Focus
1Change Component Value
Component Value
self.focusData.isFocusHeld
Value
true

A.39 Show While Focusing

Built in Chapter 10, Focus.

Logic ComponentShow While FocusingAttach to: Hit Area

Shows this Object only while the Focus Command is held.

Attach toAny Object
When Created
WhenCreate
1Set Alpha
Alpha
0
On Begin Step
WhenBegin Step
1Set Alpha
Alpha
0
While Focus Is Held
WhenCommand HeldCommand: Focus
1Set Alpha

A.40 Aim at Fighter (Function)

Built in Chapter 11, The Command Bomber.

FunctionAim at Fighter

Gives aimDegrees: the direction from the shooter toward the Fighter, at least minimumForwardMeters to the south, kept within aimConeDegrees of south (-90).

PARAMETERS
NameTypeStarts at
shooterObject
fighterObjectFighter
minimumForwardMetersNumber2.8
aimConeDegreesNumber65
RETURN TYPENumber
ACTIONS
1Declare Variable
Name
toFighterX
Value
0
2Declare Variable
Name
toFighterY
Value
0
3Declare Variable
Name
direction
Value
-90
4Check Instance Count
Action Name
fighterInSky
Object
fighter
Operator
>
Value
0
5IffighterInSky.value == true
Then
6Change Variable
Variable
toFighterX
Value
fighter.transform.position.x - shooter.transform.position.x
7Change Variable
Variable
toFighterY
Value
fighter.transform.position.y - shooter.transform.position.y
8Otherwise
9Change Variable
Variable
toFighterX
Value
0
10Change Variable
Variable
toFighterY
Value
-minimumForwardMeters
11IftoFighterY > (-minimumForwardMeters)
Then
12Change Variable
Variable
toFighterY
Value
-minimumForwardMeters
13Change Variable
Variable
direction
Value
radtodeg(atan2(toFighterY, toFighterX))
14Ifdirection < (-90 - aimConeDegrees)
Then
15Change Variable
Variable
direction
Value
-90 - aimConeDegrees
16Ifdirection > (-90 + aimConeDegrees)
Then
17Change Variable
Variable
direction
Value
-90 + aimConeDegrees
18Return
Value
direction

A.41 Command Bomber Aimed Volleys

Built in Chapter 11, The Command Bomber.

Logic ComponentCommand Bomber Aimed VolleysAttach to: Command Bomber

Every aimedSeconds of the current phase, flashes a warning at the muzzles that will fire, then fires aimed tracers toward the Fighter aimedWarningSeconds later.

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
tracerObjectConstantNone
fighterObjectConstantNone
aimedTracerSpeedNumberConstant8.9
minimumForwardMetersNumberConstant2.8
aimConeDegreesNumberConstant65
phaseRowNumberConstant0
On Phase Started
WhenphaseStartedCustom Event
1Stop Recurring Timer
Timer Name
"aimedWarning"
2Stop Recurring Timer
Timer Name
"aimedVolley"
3Start Recurring Timer
Timer Name
"aimedWarning"
Repeat Every (s)
data('Command Bomber Phases', @self.phaseRow, 'aimedSeconds')
First Delay (s)
data('Command Bomber Phases', @self.phaseRow, 'aimedFirstSeconds')
On the Aimed Warning Timer
WhenRecurring TimerTimer name: aimedWarning
1Declare Variable
Name
aimedWarningParticles
Value
0
2Change Variable
Variable
aimedWarningParticles
Value
data('Command Bomber Phases', @self.phaseRow, 'aimedWarningParticles')
3Ifdata('Command Bomber Phases', @self.phaseRow, 'aimedNose') == true
Then
4Burst Particles
Particles
Enemy Gun Muzzle
Position Relative To
Coordinate
Coordinate
Nose Muzzle
Count
aimedWarningParticles
Z Index Offset
2
5Ifdata('Command Bomber Phases', @self.phaseRow, 'aimedWings') == true
Then
6Burst Particles
Particles
Enemy Gun Muzzle
Position Relative To
Coordinate
Coordinate
Port Muzzle
Count
aimedWarningParticles
Z Index Offset
2
7Burst Particles
Particles
Enemy Gun Muzzle
Position Relative To
Coordinate
Coordinate
Starboard Muzzle
Count
aimedWarningParticles
Z Index Offset
2
8Start Recurring Timer
Timer Name
"aimedVolley"
Repeat Every (s)
data('Command Bomber Phases', @self.phaseRow, 'aimedWarningSeconds')
Ring Once
Yes
On the Aimed Volley Timer
WhenRecurring TimerTimer name: aimedVolley
1Declare Variable
Name
aimedFlashParticles
Value
0
2Change Variable
Variable
aimedFlashParticles
Value
data('Command Bomber Phases', @self.phaseRow, 'aimedFlashParticles')
3Control Sound
Sound
Enemy Guns
4Aim at FighterFunction
Action Name
aim
shooter
self
fighter
@self.fighter
minimumForwardMeters
@self.minimumForwardMeters
aimConeDegrees
@self.aimConeDegrees
5Ifdata('Command Bomber Phases', @self.phaseRow, 'aimedNose') == true
Then
6Fire From MuzzleFunction
shooter
self
tracer
@self.tracer
muzzle
"Nose Muzzle"
tracerSpeed
@self.aimedTracerSpeed
flashParticles
aimedFlashParticles
direction
aim.value
flash
'Enemy Gun Muzzle'
7Ifdata('Command Bomber Phases', @self.phaseRow, 'aimedWings') == true
Then
8Fire From MuzzleFunction
shooter
self
tracer
@self.tracer
muzzle
"Port Muzzle"
tracerSpeed
@self.aimedTracerSpeed
flashParticles
aimedFlashParticles
direction
aim.value
flash
'Enemy Gun Muzzle'
9Fire From MuzzleFunction
shooter
self
tracer
@self.tracer
muzzle
"Starboard Muzzle"
tracerSpeed
@self.aimedTracerSpeed
flashParticles
aimedFlashParticles
direction
aim.value
flash
'Enemy Gun Muzzle'

A.42 Command Bomber Arrival

Built in Chapter 11, The Command Bomber.

Logic ComponentCommand Bomber ArrivalAttach to: Command Bomber

When the Command Bomber comes into view: shows its health bar, keeps the Fighter out of the top laneMeters of the view, and flies on with the camera once it is formationAboveMiddleMeters above the middle of the view.

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
laneMetersNumberConstant6.9
formationAboveMiddleMetersNumberConstant3.4
When Entering the View
WhenEnter View
1Declare Variable
Name
distanceToFormation
Value
0
2Declare Variable
Name
formationY
Value
0
3Set UI Group Visibility
UI Group
"commandBomber"
4Change Variable
Variable
$bomberLaneMeters
Value
@self.laneMeters
5Change Variable
Variable
formationY
Value
$viewMiddleY + @self.formationAboveMiddleMeters
6Change Variable
Variable
distanceToFormation
Value
self.transform.position.y - formationY
7Start Recurring Timer
Timer Name
"formation"
Repeat Every (s)
distanceToFormation / $scrollSpeed
Ring Once
Yes
8Trigger Custom Event on Object
Custom Event
phaseStarted
On the Formation Timer
WhenRecurring TimerTimer name: formation
1Set Velocity
Y Velocity
$scrollSpeed

A.43 Command Bomber Flak

Built in Chapter 11, The Command Bomber.

Logic ComponentCommand Bomber FlakAttach to: Command Bomber

In phases with flak: every flakSeconds, a warning at the nose, then a fan of flakTracers tracers flakArcDegrees wide, centered on south, at flakSpeed.

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
tracerObjectConstantNone
warningShakeSecondsNumberConstant0.2
phaseRowNumberConstant0
On Phase Started
WhenphaseStartedCustom Event
1Stop Recurring Timer
Timer Name
"flakWarning"
2Stop Recurring Timer
Timer Name
"flakFan"
3Ifdata('Command Bomber Phases', @self.phaseRow, 'flakTracers') > 0
Then
4Start Recurring Timer
Timer Name
"flakWarning"
Repeat Every (s)
data('Command Bomber Phases', @self.phaseRow, 'flakSeconds')
First Delay (s)
data('Command Bomber Phases', @self.phaseRow, 'flakFirstSeconds')
On the Flak Warning Timer
WhenRecurring TimerTimer name: flakWarning
1Burst Particles
Particles
Enemy Gun Muzzle
Position Relative To
Coordinate
Coordinate
Nose Muzzle
Count
data('Command Bomber Phases', @self.phaseRow, 'flakWarningParticles')
Z Index Offset
2
2Camera Shake
Intensity
data('Command Bomber Phases', @self.phaseRow, 'flakWarningShake')
Seconds
@self.warningShakeSeconds
3Start Recurring Timer
Timer Name
"flakFan"
Repeat Every (s)
data('Command Bomber Phases', @self.phaseRow, 'flakWarningSeconds')
Ring Once
Yes
On the Flak Fan Timer
WhenRecurring TimerTimer name: flakFan
1Declare Variable
Name
flakArcDegrees
Value
0
2Declare Variable
Name
flakTracers
Value
0
3Declare Variable
Name
fanStep
Value
0
4Declare Variable
Name
firstAngle
Value
0
5Change Variable
Variable
flakTracers
Value
data('Command Bomber Phases', @self.phaseRow, 'flakTracers')
6Change Variable
Variable
flakArcDegrees
Value
data('Command Bomber Phases', @self.phaseRow, 'flakArcDegrees')
7Control Sound
Sound
Enemy Guns
8Burst Particles
Particles
Enemy Gun Muzzle
Position Relative To
Coordinate
Coordinate
Nose Muzzle
Count
data('Command Bomber Phases', @self.phaseRow, 'flakFlashParticles')
Z Index Offset
2
9Change Variable
Variable
firstAngle
Value
-90
10Change Variable
Variable
fanStep
Value
0
11IfflakTracers > 1
Then
12Change Variable
Variable
firstAngle
Operator
-=
Value
flakArcDegrees / 2
13Change Variable
Variable
fanStep
Value
flakArcDegrees / (flakTracers - 1)
14RepeatflakTracerstimes
Each time
15Fire From MuzzleFunction
shooter
self
tracer
@self.tracer
muzzle
"Nose Muzzle"
tracerSpeed
data('Command Bomber Phases', @self.phaseRow, 'flakSpeed')
flashParticles
0
direction
firstAngle + fanStep * local.index
flash
'Enemy Gun Muzzle'

A.44 Command Bomber Guns

Built in Chapter 11, The Command Bomber.

Logic ComponentCommand Bomber GunsAttach to: Command Bomber

Fires straight south from the wing muzzles (and the nose when its phase says so) every gunSeconds of the current phase.

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
tracerObjectConstantNone
tracerSpeedNumberConstant7.7
phaseRowNumberConstant0
On Phase Started
WhenphaseStartedCustom Event
1Stop Recurring Timer
Timer Name
"bomberGuns"
2Start Recurring Timer
Timer Name
"bomberGuns"
Repeat Every (s)
data('Command Bomber Phases', @self.phaseRow, 'gunSeconds')
First Delay (s)
data('Command Bomber Phases', @self.phaseRow, 'gunFirstSeconds')
On the Bomber Guns Timer
WhenRecurring TimerTimer name: bomberGuns
1Declare Variable
Name
gunFlashParticles
Value
0
2Change Variable
Variable
gunFlashParticles
Value
data('Command Bomber Phases', @self.phaseRow, 'gunFlashParticles')
3Control Sound
Sound
Enemy Guns
4Fire From MuzzleFunction
shooter
self
tracer
@self.tracer
muzzle
"Port Muzzle"
tracerSpeed
@self.tracerSpeed
flashParticles
gunFlashParticles
direction
-90
flash
'Enemy Gun Muzzle'
5Fire From MuzzleFunction
shooter
self
tracer
@self.tracer
muzzle
"Starboard Muzzle"
tracerSpeed
@self.tracerSpeed
flashParticles
gunFlashParticles
direction
-90
flash
'Enemy Gun Muzzle'
6Ifdata('Command Bomber Phases', @self.phaseRow, 'gunNose') == true
Then
7Fire From MuzzleFunction
shooter
self
tracer
@self.tracer
muzzle
"Nose Muzzle"
tracerSpeed
@self.tracerSpeed
flashParticles
gunFlashParticles
direction
-90
flash
'Enemy Gun Muzzle'

A.45 Command Bomber Health

Built in Chapter 11, The Command Bomber.

Logic ComponentCommand Bomber HealthAttach to: Command Bomber

Starts the Command Bomber at startingHealth; each time a phase's share of the health is used up (Meter Threshold Reached) it moves to the next row of Command Bomber Phases, and after the last it is shot down.

Attach toAny Object
DATA STRUCTURES
Command Bomber Stateself.commandBomberState
SHARED VARIABLES
NameTypeKindStarting Value
startingHealthNumberConstant240
wingCannonsObjectConstantNone
shotDownParticlesNumberConstant132
shotDownShakeNumberConstant0.045
shotDownShakeSecondsNumberConstant0.8
When Created
WhenCreate
1Change Component Value
Component Value
self.commandBomberState.maxHealth
Value
@self.startingHealth
2Change Component Value
Component Value
self.commandBomberState.maxHealth
Operator
*=
Value
data('Round Settings', $roundRow, 'commandBomberHealthScale')
3Change Component Value
Component Value
self.commandBomberState.maxHealth
Value
round(self.commandBomberState.maxHealth)
4Change Component Value
Component Value
self.commandBomberState.phaseRow
Value
0
On Meter Threshold Reached · Meter With Thresholds Data.meter
WhenMeter Threshold ReachedMeter variable: meterWithThresholdsData.meter
ModeNext Phase (Starting Mode)
1Declare Variable
Name
newPhaseRow
Value
0
2Change Component Value
Component Value
self.commandBomberState.phaseRow
Operator
+=
Value
1
3Change Variable
Variable
newPhaseRow
Value
self.commandBomberState.phaseRow
4Trigger Custom Event on Object
Custom Event
phaseStarted
5Camera Shake
Intensity
data('Command Bomber Phases', newPhaseRow, 'startShake')
Seconds
data('Command Bomber Phases', newPhaseRow, 'startShakeSeconds')
6Burst Particles
Particles
Flak Burst
Count
data('Command Bomber Phases', newPhaseRow, 'startFlakParticles')
Z Index Offset
2
7Ifdata('Command Bomber Phases', newPhaseRow, 'dropsWingCannons') == true
Then
8Create Instance
Object to Create
@self.wingCannons
Position Relative To
Self
9IfnewPhaseRow == (dataCount('Command Bomber Phases') - 1)
Then
10Switch Mode
Event
On Meter Threshold Reached · Meter With Thresholds Data.meter
Mode
Shot Down
On Meter Threshold Reached · Meter With Thresholds Data.meter
WhenMeter Threshold ReachedMeter variable: meterWithThresholdsData.meter
ModeShot Down
1Trigger Custom Event
Custom Event
commandBomberShotDown
2Control Sound
Sound
Plane Break
3Camera Shake
Intensity
@self.shotDownShake
Seconds
@self.shotDownShakeSeconds
4Burst Particles
Particles
Plane Explosion
Count
@self.shotDownParticles
Z Index Offset
2
5Set UI Group Visibility
UI Group
"commandBomber"
Visible
No
6Change Variable
Variable
$bomberLaneMeters
Value
0
7Destroy Instance

A.46 Command Bomber Hits

Built in Chapter 11, The Command Bomber.

Logic ComponentCommand Bomber HitsAttach to: Command Bomber

Each Fighter Tracer that hits adds one to the Command Bomber's damage (changeMeter), makes sparks, reports commandBomberHit, and flashes it white, settling on its current phase's tint.

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
flashColorColorConstant#ffffff
flashSecondsNumberConstant0.07
hitParticlesNumberConstant10
phaseRowNumberConstant0
When Starting to Hit Fighter Tracer
WhenCollision EnterObject: Fighter Tracer
1Trigger Custom Event on Object
Custom Event
changeMeter
2Burst Particles
Particles
Flak Burst
Count
@self.hitParticles
Z Index Offset
2
3Trigger Custom Event
Custom Event
commandBomberHit
4Flash on HitFunction
target
self
flashColor
@self.flashColor
flashSeconds
@self.flashSeconds
settleTint
data('Command Bomber Phases', @self.phaseRow, 'damageTint')

A.47 Flash on Hit (Function)

Built in Chapter 11, The Command Bomber.

FunctionFlash on Hit

Flashes the target's sprite flashColor for flashSeconds, then tints it settleTint.

PARAMETERS
NameTypeStarts at
targetObject
flashColorColor#ffffff
flashSecondsNumber0.07
settleTintColor#ffd0b8
ACTIONS
1Tint SpriteFunction
target
target
color
flashColor
mode
"solid"
2Wait
Seconds
flashSeconds
3Tint SpriteFunction
target
target
color
settleTint
mode
"multiply"

A.48 Meter with Thresholds

Comes whole from Myth’s templates. Built in Chapter 11, The Command Bomber.

Logic ComponentMeter with ThresholdsAttach to: Command Bomber

Keeps a meter between minimum and maximum, changes it by changeAmount each time it receives changeMeter, and runs Meter Threshold Reached once when the meter climbs to threshold (or Meter Threshold Lost when it falls back below it). meterField names the Data Structure field the meter is kept in, where other Logic can read it.

Attach toAny Object
DATA STRUCTURES
Meter with Thresholds Dataself.meterWithThresholdsData
SHARED VARIABLES
NameTypeKindStarting Value
changeAmountNumberConstant1
minimumNumberConstant0
maximumNumberConstant100
thresholdNumberConstant100
meterFieldTextConstant(empty)
Built in: this Logic Component comes whole from the engine's template.
You add it and set its Variables on the Object; you do not build its Events.

A.49 Show Command Bomber Health

Built in Chapter 11, The Command Bomber.

Logic ComponentShow Command Bomber HealthAttach to: Command Bomber Health Bar

Shrinks this bar to the Command Bomber's share of health left each time it is hit.

Attach toAny Object
On Command Bomber Hit
WhencommandBomberHitCustom Event
1Declare Variable
Name
healthLeft
Value
0
2Change Variable
Variable
healthLeft
Value
other.commandBomberState.maxHealth - other.commandBomberState.damage
3Set Scale
Horizontal Scale
healthLeft / other.commandBomberState.maxHealth

A.50 Round Sky Color

Built in Chapter 12, Rounds and Mission Complete.

Logic ComponentRound Sky ColorAttach to: Round Sky

Tints the sky for the current round, from the Round Settings table.

Attach toAny Object
When Created
WhenCreate
1Change Sprite Tint Property
Value
data('Round Settings', $roundRow, 'skyTint')
2Change Sprite Tint Property
Property
Mode
Value
"multiply"
3Change Sprite Tint Property
Property
Enabled
Value
true
4Set Alpha
Alpha
data('Round Settings', $roundRow, 'skyAlpha')

A.51 Rounds

Built in Chapter 12, Rounds and Mission Complete.

Logic ComponentRoundsAttach to: Game Rules

When the Command Bomber is shot down: if rounds are left, waits breatherSeconds and flies the route again in the next round; after the last, the mission is complete. When a round is over it sends roundOver. Each round starts with no scenery moved ahead and the kill chain at x1.

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
breatherSecondsNumberConstant3.5
fadeSecondsNumberConstant0.8
On Command Bomber Scored
WhencommandBomberScoredCustom Event
1Check Game State
Action Name
stillPlaying
Game State
Playing
2IfstillPlaying.value == true
Then
3If$roundRow < (dataCount('Round Settings') - 1)
Then
4Start Recurring Timer
Timer Name
"roundBreather"
Repeat Every (s)
@self.breatherSeconds
Ring Once
Yes
5Otherwise
6Set Game State
Game State
Mission Complete
7Trigger Custom Event
Custom Event
roundOver
On the Round Breather Timer
WhenRecurring TimerTimer name: roundBreather
1Check Game State
Action Name
playingAfterBreather
Game State
Playing
2IfplayingAfterBreather.value == true
Then
3Change Variable
Variable
$roundRow
Operator
+=
Value
1
4Trigger Custom Event
Custom Event
roundOver
5Go to Scene
Scene
Route
Transition
Fade
Transition Seconds
@self.fadeSeconds
When the Scene Starts
WhenScene Start
1Change Variable
Variable
$furthestSceneryY
Value
0
2Change Variable
Variable
$chainRow
Value
0
3Check Game State
Action Name
isPlaying
Game State
Playing
4IfisPlaying.value == true
Then
5Set UI Group Visibility
UI Group
"flight"
6Set UI Group Visibility
UI Group
"sky"

A.52 Show at Game State

Built in Chapter 12, Rounds and Mission Complete.

Logic ComponentShow at Game StateAttach to: Mission Failed Menu, Mission Complete Menu

When the Game State becomes gameState, waits delaySeconds, then shows menu and pauses the world behind it.

Attach toAny Object
SHARED VARIABLES
NameTypeKindStarting Value
gameStateTextConstantmission-failed
menuObjectConstantNone
delaySecondsNumberConstant1
On Game State Changed
WhenGame State Changed
1Ifevent.current == @self.gameState
Then
2Start Recurring Timer
Timer Name
"showScreen"
Repeat Every (s)
@self.delaySeconds
Ring Once
Yes
On the Show Screen Timer
WhenRecurring TimerTimer name: showScreen
1Control Menu
Menu Element
@self.menu
2Set Menu Pause State
Menu Element
@self.menu