- Learn
- Build a Game
- Shatterfield
- 8 Saucers
8 Saucers
Until now, the rocks were the only danger, and a rock never aims. By the end of this chapter, a saucer crosses the field now and then, its siren wailing. The large one fires plasma Orbs every which way. The small one aims. Shoot one down for 200 or 1,000 points, or let its shot find you.
The game as it is at the end of this chapter. Click the game to play.
If your game and this chapter part ways, here is the chapter’s finished project. Open it and compare, or start Chapter 9 from it.
To open it, right-click the downloaded file, choose Extract All... and then Extract. Start Myth Engine, choose File › Open Project... and pick the .mythproj file in the new folder. Beside it, OFL.txt is the license of the project’s font, Press Start 2P.
8.1 The Idea
A game is sixteen seconds old when the siren starts.
Then a wide white saucer with a green dome slides in from beyond one side of the screen. It doesn’t drift the way a rock does. It crosses, steady, and every second or so it climbs, dives or levels off. A crackling pink-red ball bursts from it and flies off in a direction nobody chose. Another follows. One clips a rock, and the rock cracks apart. The score doesn’t move.
The saucer slides off the far side, and the siren stops.
Catch it before it goes, and it bursts in a ball of light, with a gold 200 rising off it. Touch it, or one of its shots, and it’s your Ship that bursts.
That’s a lot of new pieces, and most of them work the way you’ve seen before. One thing is really new. Since Chapter 4, a rock has answered one message, hit, and hit always meant the same thing: you broke me, so count my points. Now there are two ways to break a rock. Your Shot breaks it, and you earn its points. A saucer’s shot can break it too, and when that happens, nobody earns a single point.
So the rock learns a second message, breakUp. It means: break, and count nothing. When hit arrives, the rock counts its points first and then sends breakUp to itself. A saucer’s shot skips the counting and sends breakUp straight to the rock.
Think of a house with two doors. A guest rings at the front door, hit, and someone writes the name in the guest book. That’s the points. Family come in at the back, breakUp, and nobody writes anything down. Either way, everyone ends up in the same kitchen: the one Event that does the breaking.
8.2 The Plan
Here’s how the pieces work together, read from left to right.
- The game starts -> Saucer Spawner sets its saucerCheck timer, Ring Once, for 16 seconds.
- The saucerCheck timer rings, and no saucer is flying -> Saucer Spawner makes a Saucer Large, or now and then a Saucer Small. It sets the next check too.
- A saucer appears -> Saucer Flight picks a side and a height, starts the siren and sends it across. Saucer Gun starts its saucerFire timer.
- The saucerFire timer rings -> Saucer Gun makes a shot -> Saucer Shot Flight points it and sends it off.
- A saucer’s shot touches a rock -> the rock gets breakUp.
- A Shot touches a saucer -> Shot Impact sends hit -> Saucer Explodes adds its points and explodes.
- The Ship touches a saucer or a saucer’s shot -> Ship Crash sends it hit, and the Ship is lost.
- The saucer explodes or reaches the far side -> Saucer Flight stops the siren.
8.3 Set Up
This chapter needs four pictures and two sounds. They’re already in your project: two saucers, their two kinds of shot, the wail of a crossing and the pulse of every shot.
8.4 A Second Way to Break
First, the rocks learn to tell your shots from theirs.
8.4.1 Break Apart
Since Chapter 4, everything a breaking rock does has been in one Event of Break Apart. Now that Event splits in two.
The hit Event keeps the three Actions that score: the Change Variable, the scored message and the rising points from Chapter 7. Below them goes one new Action. It’s a Trigger Custom Event on Object, sending breakUp. Its Applies To starts on Self, and Self is the rock. So the rock sends breakUp to itself, and the card needs no Applies To line.
Everything else moves to a new Event that listens for breakUp. That’s the sparks, the sound, the shake, the fragments and the Destroy Instance.
Start in the hit Event. Right-click Destroy Instance, at the end of its line, choose Add unattached Action here, and pick Trigger Custom Event on Object. Type breakUp into its Custom Event box. Then right-click it and choose Connect to sequence. For now it joins at the very end, below Destroy Instance. That’s all right. Once the others move out, it will sit right where the card puts it.
Now the move. Nothing gets built twice. Click Burst Particles, then Shift+click Destroy Instance. Right-click either one and choose Cut 6 blocks, and your new Action slides up to sit right under Popup Text.
Make the new Event the way you made hit in Chapter 4. Type Custom into the Add Event window’s filter, pick Add Custom Event…, and type breakUp. On the card, its heading is On Break Up.
Right-click the empty spot close beside On Break Up’s Mode 1, on its right, and choose Paste. The six blocks arrive there, loose, in the same order. Right-click Burst Particles and choose Connect to sequence, and the whole line joins Mode 1 at once.
On the card, they sit plain under On Break Up, because they aren’t new. Nothing is struck where they were.
An Asteroid hit by the player scores and shows its points; any Asteroid that breaks up bursts into sparks, plays its break sound, leaves its fragments and is destroyed.
Any Object- Variable
$score- Operator
+=- Value
@self.points
- Custom Event
scored
- Text
text(@self.points)- Color
@self.popupColor- Size
@self.popupSize- Rise
@self.popupRise- Seconds
@self.popupSeconds
- Custom Event
breakUp
- Particles
"Impact Sparks"- Count
@self.sparkCount
- Sound
@self.breakSound
@self.shake > 0- Intensity
@self.shake- Seconds
@self.shakeSeconds
@self.fragmentstimes- Object to Create
@self.fragment- Position Relative To
Self- Created As
newFragment
Run the game, and it plays exactly as before. A rock you shoot still scores, sparks and breaks, because hit now ends by sending breakUp.
Nothing else sends breakUp yet. The saucers’ shots will.
8.5 Saucer Shots
The shots come before the saucers, because each saucer names its shot.
8.5.1 Saucer Shot Flight
A saucer’s shot is born at the saucer. From then on, it does its whole job alone, and Saucer Shot Flight is that job, for the Orb and the Lance alike.
When it’s created, it picks a heading. Generate Random Number chooses shotHeading, from 0 to 359 degrees, and Set Rotation turns the shot that way. A new Generate Random Number starts with its Minimum at 0, so the card gives only the Maximum. For an Orb, that’s all the aiming there is.
Every saucer shot has a Yes or No Shared Variable, aimed. It starts on No. A Lance sets it to Yes, so an If asks whether this shot is aimed. Inside it waits a second question, because between lives there’s no Ship to aim at. Check Instance Count looks, and keeps its answer as isShipThere.
If the Ship is there, Face Toward turns the Lance to look right at it. Its Rotation Offset is aimOffset, a random few degrees to either side, never more than aimSpread, 7 degrees. So a Lance comes close. Never quite exact.
Then the shot goes the way it faces. Set Direction points its motion at self.transform.rotation.z, the angle the shot is turned to now. Set Speed sends it off, about half as fast as your own Shots. And a shotLife timer starts, Ring Once, for lifeSeconds, 1.15 seconds.
Three things end a shot. Its timer rings, and it’s gone. It touches a rock, and its Collision Enter sends breakUp to other, the rock, before it goes. Or the Ship flies into it. Ship Crash sends it hit, and its last Event removes it.
Build it as always, its SHARED VARIABLES first, each one Constant. ship holds an Object, so its Starting Value is a None button. Leave it. Each kind of shot fills it in. aimed is a Boolean, a Yes or No, third in the Type list. Its Starting Value turns into a Yes / No list. Leave it on No. The three Numbers follow.
The Actions go in from Mode 1’s right-click, each joined with Connect to sequence. Each If takes its condition in its one box. Check Instance Count and the second If go inside the first, each with Add inside Then, and the aimOffset roll and Face Toward go inside the second the same way. Two lists hold @self.ship: Check Instance Count’s Object and Face Toward’s Target Object. Set Direction’s box takes self.transform.rotation.z, typed as the card has it. A shot’s own Transform is always there to read.
The Collision Enter Event names Tagged Asteroid, picked in its block’s Collision section, as you did for Shot Impact in Chapter 4. And self.collider arrives on the Components card by itself, as it did then.
A saucer shot flies in a random direction, or at the Ship if it is aimed, and is gone after lifeSeconds or when it touches something.
Any Object- Action Name
shotHeading- Maximum
359
- Degrees
shotHeading.value
@self.aimed == true- Action Name
isShipThere- Object
@self.ship- Operator
>- Value
0
isShipThere.value == true- Action Name
aimOffset- Minimum
-@self.aimSpread- Maximum
@self.aimSpread
- Target Object
@self.ship- Rotation Offset
aimOffset.value
- Direction
self.transform.rotation.z
- Speed
@self.speed
- Timer Name
shotLife- Repeat Every (s)
@self.lifeSeconds- Ring Once
Yes
- Applies To
other- Custom Event
breakUp
8.5.2 Saucer Orb and Saucer Lance
The two kinds of shot share a Tag, the way the rocks share Asteroid. This one is Saucer Shot. Later, the Ship names the Tag once, and both kinds of shot count.
Saucer Orb comes first. It’s a 2D Object, like the rocks, with the Saucer Orb Sprite, a crackling pink-red ball. Its Collider is a small Circle. It stays Solid, the way a new Collider starts, and there’s a reason for that at the end of the chapter.
Its Collide Only With list gets two names, both from Search to add…. The window there is called Add an Object or Tag to Meet, and it lists Objects by name as well as Tags. Pick Ship, and then Tagged Asteroid. No saucer is on that list, so a saucer’s own shots pass right through saucers.
Attach Tags, and make Saucer Shot with Create New Tag…, the way you made Asteroid. Attach Saucer Shot Flight, then Wrap Around World. Under Variables, press ship’s Value button and pick Ship. aimed stays on No, and that’s all the Orb needs.
X 1.625, Y 1.625Circle0.313Collide Only WithShip, Tagged Asteroid15Saucer Orb SpriteX 1.625, Y 1.625Saucer ShotShipSaucer Lance is a copy. Duplicate Saucer Orb, and rename the copy Saucer Lance. It’s the long red-orange spear, so pick the Saucer Lance Sprite, and give it the card’s Sizes and a Collider a little smaller than the Orb’s. Under Variables, set aimed to Yes.
X 2.375, Y 1.1875Circle0.234Collide Only WithShip, Tagged Asteroid15Saucer Lance SpriteX 2.375, Y 1.1875Saucer ShotShipYesNothing makes a saucer’s shot yet, so you won’t see one until the next part gives them a saucer to fire from.
8.6 The Saucers
Now the saucers: three Logic Components first, then the Objects that carry them.
8.6.1 Saucer Flight
Saucer Flight has the longest card in the chapter, so take it one Event at a time.
It has something to remember, too. The side a saucer picks at its birth decides where it starts and which way it flies. Those two facts have to last, so they live in a Data Structure, like Ship Shield Data in Chapter 5. Its card, Saucer Flight Data, comes with Saucer Flight’s: two Numbers, direction and startX.
Make it with Add > Data Structure. Press Add Field twice. Type direction over the first field’s name, and startX over the second’s. Both are Numbers already. The Value of direction is 1, so type 1 into its box, and startX keeps its 0.
Object Data of Logic "Saucer Flight" (its state that lasts between Events).
Now make Saucer Flight, its SHARED VARIABLES first, each a Number, Constant. Press the + on its Data Structures card, and pick Saucer Flight Data under Existing Data Structures. Its row reads self.saucerFlightData.
A saucer is born a little way off the screen, and its Create Event decides where. First a coin toss, sideRoll, picks 0 or 1. On a 0, it waits past the left edge, 1.25 meters out, facing right. On a 1, it’s the right edge, facing left. The If writes that choice into the two fields. direction is 1 for right and -1 for left, and startX is where the saucer waits.
Each Change Component Value takes its field’s path typed, self.saucerFlightData.direction or self.saucerFlightData.startX, then Enter, as in Chapter 5. An = and a Value appear. Type the card’s Value there. The first two go in with Add inside Then. Right-click the If and choose Add Else, and the other two go in with Add inside Else.
Then comes a height, anywhere from minDepth to maxDepth below the top of the screen. Set Position puts the saucer there, its X read from startX. Set Velocity sends it across, level, with a 0 typed into its Y Velocity.
Last, three things start. Control Sound’s Operation is a list that starts on Play. Pick Loop. Its Sound list gives Saucer Siren. And two Ring Once timers begin at the same moment, nextWeave and the longer crossing.
How long is a crossing? The saucer covers the whole screen, plus a margin at each end, and that’s $areaWidth + 2 * @self.margin meters. Divide by the speed, and you have the seconds. When crossing rings, the saucer has reached the far side, and Destroy Instance removes it.
Meanwhile, nextWeave rings, and the saucer starts its weave. Generate Random Integer picks weaveRoll, -1, 0 or 1, and Set Velocity sets only the Y, to weaveRoll times weaveSpeed. The saucer dives, levels off or climbs. Its X Velocity box stays blank.
Remember Chapter 3? There, a blank X would have let the Ship drift on after a jump, so you typed a 0. Here, going on is the whole point. A blank X keeps the saucer crossing.
Then the Event picks weaveSeconds, between 0.8 and 1.6 seconds, and starts nextWeave again. A Ring Once timer can restart itself from its own Event, and that’s how the saucer weaves all the way across.
A diving saucer can sink off the bottom. When it goes out of sight, the Leave View Event runs. It’s a new kind, so type Leave into the Add Event window’s filter, and pick Leave View.
Its two Ifs read self.transform.position.y, the saucer’s own height. Gone above the top? It moves one screen lower, and below the bottom it moves one screen higher. A saucer leaving past a side matches neither If, and that’s right, since it’s on its way out anyway.
The last Event, When Destroyed, fixes a problem you met in Chapter 5. A looping sound outlives its Object, like the Thrust hum. So however the saucer goes, shot down or flown off, Control Sound stops Saucer Siren. This time its Operation is Stop.
A saucer enters beyond a random side at a random height, crosses at its speed while weaving up and down, and leaves at the far side.
Any Objectself.saucerFlightData- Action Name
sideRoll- Maximum
1
sideRoll.value == 0- Component Value
self.saucerFlightData.direction- Value
1
- Component Value
self.saucerFlightData.startX- Value
-@self.margin
- Component Value
self.saucerFlightData.direction- Value
-1
- Component Value
self.saucerFlightData.startX- Value
$areaWidth + @self.margin
- Action Name
depthBelowTop- Minimum
@self.minDepth- Maximum
@self.maxDepth
- X
self.saucerFlightData.startX- Y
$areaHeight - depthBelowTop.value
- X Velocity
self.saucerFlightData.direction * @self.speed- Y Velocity
0
- Operation
Loop- Sound
"Saucer Siren"
- Timer Name
nextWeave- Repeat Every (s)
@self.firstWeaveSeconds- Ring Once
Yes
- Timer Name
crossing- Repeat Every (s)
($areaWidth + 2 * @self.margin) / @self.speed- Ring Once
Yes
- Action Name
weaveRoll- Minimum
-1- Maximum
1
- Y Velocity
weaveRoll.value * @self.weaveSpeed
- Action Name
weaveSeconds- Minimum
@self.weaveMinSeconds- Maximum
@self.weaveMaxSeconds
- Timer Name
nextWeave- Repeat Every (s)
weaveSeconds.value- Ring Once
Yes
self.transform.position.y > $areaHeight- X
self.transform.position.x- Y
self.transform.position.y - $areaHeight
self.transform.position.y < 0- X
self.transform.position.x- Y
self.transform.position.y + $areaHeight
- Operation
Stop- Sound
"Saucer Siren"
8.6.2 Saucer Gun
Saucer Gun is short. It holds two SHARED VARIABLES: shot, an Object with its None button, and fireEvery, 1.35. When a saucer is created, the gun starts its saucerFire timer. Every fireEvery seconds it rings, and Create Instance makes shot right where the saucer is while Saucer Pulse plays.
It’s the Create Instance you used for Ship Gun in Chapter 2. Pick @self.shot in Object to Create. Position Relative To starts on World, and the shot should start at the saucer, so pick Self. Each saucer names its own shot, and the gun never aims.
The shot aims itself.
A saucer fires its own shot every fireEvery seconds, with the pulse sound.
Any Object- Timer Name
saucerFire- Repeat Every (s)
@self.fireEvery
- Object to Create
@self.shot- Position Relative To
Self- Created As
newShot
- Sound
"Saucer Pulse"
8.6.3 Saucer Explodes
Saucer Explodes waits for hit, the same message a rock gets. Shot Impact sends it, so type hit into the Add Event window’s filter, and it’s there.
When hit arrives, the saucer adds its points to $score and tells the game scored, as Break Apart does, so Score and Extra Ships hear a saucer’s points too. It shows them in gold. It bursts into 60 bits of Ship Explosion while ExplosionLarge booms and the camera shakes. Destroy Instance removes it. Saucer Flight’s When Destroyed stops the siren.
Its eight SHARED VARIABLES come first. popupColor is a Color, its gold code typed after the #. The first three Actions are built the way you built Break Apart’s in Chapter 7. Change Variable takes += · Add and @self.points. Popup Text’s Text is {sharedVar("self","points")}, quotes and all, the same way around Myth’s gap. Its Color takes @self.popupColor, the saucer’s gold.
Notice there’s no breakUp Event here, because a saucer has only one way to go.
A saucer that is hit gives the player its points, shows them, explodes and is destroyed.
Any Object- Variable
$score- Operator
+=- Value
@self.points
- Custom Event
scored
- Text
text(@self.points)- Color
@self.popupColor- Size
@self.popupSize- Rise
@self.popupRise- Seconds
@self.popupSeconds
- Particles
"Ship Explosion"- Count
@self.explosionCount
- Sound
"ExplosionLarge"
- Intensity
@self.shake- Seconds
@self.shakeSeconds
Nothing sends a saucer hit yet. That comes in the chapter’s last part, when your Shots and your Ship learn to touch.
8.6.4 Saucer Large and Saucer Small
The two saucers share a Tag too, Saucer. Saucer Large comes first, whole, and Saucer Small is a copy of it.
Saucer Large is a 2D Object with the Saucer Large Sprite. Its Collider has no Shape line. A new Collider starts as a Box, and a Box fits a saucer’s wide, flat body, so keep it and set its Size. Like the rocks, a saucer is a Sensor, so it notices a touch and is never pushed. Its Collide Only With list gets Ship and Shot, by name, from Search to add….
Attach Tags, and make Saucer with Create New Tag…. Then attach Saucer Flight, Saucer Gun and Saucer Explodes, in the card’s order. Saucer Flight Data comes along with Saucer Flight, as Ship Shield Data came to the Ship. That’s the Data Structure line on the card. Under Variables, press shot’s Value button and pick Saucer Orb. Everything else keeps its Starting Value. Those are Saucer Large’s numbers.
X 3, Y 3SensorX 2.5, Y 1.125Collide Only WithShip, Shot12Saucer Large SpriteX 3, Y 3SaucerSaucer FlightSaucer Flight DataSaucer OrbNow Duplicate Saucer Large, and rename the copy Saucer Small. Pick the Saucer Small Sprite. The card gives its smaller Sizes, the Collider’s too. Then its Variables. The small one is faster, at 5.156 meters a second against the large one’s 3.75. It fires a Lance every 0.95 seconds, where the large one fires an Orb every 1.35. And it’s worth 1000, against 200.
Don’t place either saucer in the Scene, because Saucer Spawner makes them as the game goes.
X 1.875, Y 1.875SensorX 1.5, Y 0.75Collide Only WithShip, Shot12Saucer Small SpriteX 1.875, Y 1.875SaucerSaucer FlightSaucer Flight Data5.156Saucer Lance0.9510008.7 Sending Them Out
One last piece, and the field gets its first visitor.
8.7.1 Saucer Spawner
Saucer Spawner goes on Game Rules. It decides when a saucer comes, and which one.
When the game starts, it sets its saucerCheck timer, Ring Once, for firstSeconds, 16 seconds.
When saucerCheck rings, two Declare Variables make gapMax and gapMin, each at 0 for now. They last this one moment. The end of the Event fills them in.
Next, Check Instance Count counts the saucers and keeps the answer as isSaucerFlying. Only one saucer flies at a time. If one is out there already, this check sends nothing at all.
On the card, that count is tag:Saucer, everything that wears the Tag Saucer. Check Instance Count’s Object list has the Tags too, at its very end, after the Objects. Pick Tagged Saucer there. The block shows it as tag:Saucer, the card’s own words. It asks the card’s > 0.
The If after it asks isSaucerFlying.value == false, in its one box.
If no saucer is out, it rolls saucerRoll, a random number from 0 to 1. Those are where Minimum and Maximum start. The card has no lines for them.
A second If follows, and its box holds two questions, joined by ||, which means or. Is $score at smallAlwaysScore, forty thousand, or past it? Or is saucerRoll below the small saucer’s chance? Either one is enough. Then Create Instance makes a Saucer Small, and otherwise, Else makes a Saucer Large. Both Create Instances keep Position Relative To on World, since Saucer Flight moves each saucer to its side anyway.
That chance grows with the waves. It’s smallChance, 0.12, plus smallChancePerWave, 0.06, for every wave, so the small saucer turns up more often as the game goes on.
The rest of the Event sets the next check, whether a saucer came or not. The wait is a random number between gapMin and gapMax. Each starts from its Start value, less the wave. So the wait shrinks a second with every wave, until two Ifs stop it. The shortest wait never drops below 7 seconds, and the longest never below 11. Then saucerCheck starts again, Ring Once, for checkSeconds.
Build it the way you built Waves in Chapter 6. Its SHARED VARIABLES come first. largeSaucer and smallSaucer are Objects, with None buttons, and Game Rules fills them in. The rest are Numbers. Generate Random Number, the second If and its two Create Instances go inside the first If, with Add inside Then, Add Else and Add inside Else. Type gapMin into a Change Variable’s Variable box, and once you leave it, it reads self.gapMin, the value Declare Variable made. gapMax works the same way.
The first saucer comes firstSeconds into the game. After that, a saucer check comes a random number of seconds later (fewer in later waves) and sends a saucer when none is flying; the Small one comes more often in later waves and always at high scores.
Any Object- Timer Name
saucerCheck- Repeat Every (s)
@self.firstSeconds- Ring Once
Yes
- Name
gapMax- Value
0
- Name
gapMin- Value
0
- Action Name
isSaucerFlying- Object
tag:Saucer- Operator
>- Value
0
isSaucerFlying.value == false- Action Name
saucerRoll
$score >= @self.smallAlwaysScore || saucerRoll.value < (@self.smallChance + @self.smallChancePerWave * $wave)- Object to Create
@self.smallSaucer- Created As
newSmallSaucer
- Object to Create
@self.largeSaucer- Created As
newLargeSaucer
- Variable
gapMin- Value
@self.gapMinStart - $wave
gapMin < @self.gapMinFloor- Variable
gapMin- Value
@self.gapMinFloor
- Variable
gapMax- Value
@self.gapMaxStart - $wave
gapMax < @self.gapMaxFloor- Variable
gapMax- Value
@self.gapMaxFloor
- Action Name
checkSeconds- Minimum
gapMin- Maximum
gapMax
- Timer Name
saucerCheck- Repeat Every (s)
checkSeconds.value- Ring Once
Yes
Attach Saucer Spawner to Game Rules, below Extra Ships. Under Variables, press largeSaucer’s Value button and pick Saucer Large, then smallSaucer’s and pick Saucer Small.
Extra ShipsExtra Ships DataShipAsteroid LargeWave BannerSaucer LargeSaucer SmallRun the game, and wait. At sixteen seconds the siren starts, and a saucer slides in. Watch it weave. Its Orbs fly every which way, and when one clips a rock, the rock breaks and the score stays still.
But your Shots pass right through the saucer, and its Orbs pass through your Ship. Neither side can touch the other yet.
8.8 Fighting Back
Last, they learn to touch.
8.8.1 Shot Impact
Since Chapter 4, Shot Impact’s Collision Enter has named Tagged Asteroid. Now a Shot can hit a saucer too, with the same message, hit. So the Event no longer needs to name anything. Open the Collision section on its block, and pick Any Object, at the very top of the Collision Target list. Myth renames the Event When Starting to Hit Anything, the card’s new heading.
Any Object doesn’t mean the Shot hits everything, because the Shot’s own Collide Only With list still chooses. Its Changes card adds Tagged Saucer there, with Search to add….
A Shot that touches an Asteroid tells the Asteroid it was hit and disappears.
Any Object- Applies To
other- Custom Event
hit
X 0.8125, Y 0.8125Circle0.156Collide Only WithTagged Asteroid, Tagged SaucerTagged Asteroid15Shot SpriteX 0.8125, Y 0.8125-908.8.2 Ship Crash
Ship Crash makes the same change. Its Collision Event’s Collision Target becomes Any Object, and Myth renames it While Hitting Anything. Both Switch Modes follow on their own. They hold the Event itself, not its name. On the card, their Event lines show the old name struck and the new one in green. That’s Myth’s change, made for you, with nothing to pick again.
The Ship’s Collide Only With list grows to Tagged Asteroid, Tagged Saucer and Tagged Saucer Shot. Each is a Tag, so they cover both saucers and every Orb and Lance.
Exposed still sends hit to other. Then the thing the Ship touched decides what hit means: a rock breaks and scores, a saucer explodes and scores, and a saucer’s shot is gone.
One more thing changes, and it’s for the shield. A rock is a Sensor, so it never pushes your Ship. A saucer’s shot is solid, though, because it has to touch the rocks. And two solid things shove each other apart. So a shot could push a blinking, shielded Ship across the screen with no key down.
Ship Crash stops that. While the shield is up, it makes the Ship’s own Collider a Sensor too, and the shot flies straight through. When the shield drops, the Collider is solid again.
Ship Crash reaches its Collider through self.collider. It has been on the Components card since Chapter 5, when Myth put it there for the collision Event. Now the card lists it too, under COMPONENTS.
The switch itself is Change Component Value, and one goes in On Shield Up, right after Switch Mode. Add it from Switch Mode’s right-click, then Connect to sequence. Type self.collider.trigger into its Component Value box, and press Enter. The card shows the same thing in two lines, self.collider and the Property trigger. A Collider that’s a trigger is a Sensor. An = and a Value appear, and the Value reads false, so type true over it.
On Shield Down’s Change Component Value goes first, before Switch Mode. Add it from Mode 1’s right-click. Connect to sequence only adds to the end, so join this one with the round handles. Click the handle at the bottom of Mode 1, then the handle at the top of Change Component Value. It slips in ahead of Switch Mode, as the passage on Actions shows. Its Value stays false, as it arrives.
Touching an Asteroid, a saucer or a saucer shot destroys the Ship: it tells what it touched that it was hit, explodes, and reports shipDestroyed. While the Ship is shielded, a touch does nothing and nothing can push it.
Any ObjectCollider- Applies To
other- Custom Event
hit
- Particles
"Ship Explosion"- Count
@self.explosionCount
- Particles
"Impact Sparks"- Count
@self.crashSparkCount
- Sound
"ExplosionLarge"
- Sound
"Ship Lost"
- Intensity
@self.shake- Seconds
@self.shakeSeconds
- Custom Event
shipDestroyed
- Event
While Hitting Anything- Event
While Hitting Anything Tagged Asteroid- Mode
Shielded
- Component Value
self.collider- Value
true- Property
trigger
- Component Value
self.collider- Value
false- Property
trigger
- Event
While Hitting Anything- Event
While Hitting Anything Tagged Asteroid- Mode
Exposed
X 2.4375, Y 3.0625Circle0.594Collide Only WithTagged Asteroid, Tagged Saucer, Tagged Saucer ShotTagged Asteroid20Ship SpriteX 2.4375, Y 3.0625Ship ShieldShip Shield Data13.7529013.1251.719ShotExpression$areaWidth0Expression$areaHeightRun the game. Shoot the saucer down, and a gold 200 rises from a burst of light. Fly into an Orb, and your Ship is lost.
Forty thousand points is a long way off, and so is the small saucer. To meet it now, open Game Rules, and under Variables type 0 into smallAlwaysScore’s Value. Every saucer comes small. Watch its Lances come at you, close but never quite on target, and when you’ve seen enough, type 40000 back.
Watch for each of these.
- About 16 seconds into a game, the siren starts and a saucer slides in from beyond the left or right edge.
- It crosses at a steady pace. Every second or so it climbs, dives or flies level.
- A saucer that dives off the bottom of the screen comes back at the top.
- It leaves past the far edge, and the siren stops.
- The large saucer fires an Orb every 1.35 seconds, with a pulse sound, each in its own direction.
- An Orb that touches a rock breaks it, and the score stays the same.
- Shoot the large saucer for 200 points. The small one is worth 1,000.
- There’s never more than one saucer on the screen.
- With smallAlwaysScore at 0, every Lance comes at your Ship, close but not quite exact.
- Touch a saucer, an Orb or a Lance. Your Ship is lost.
- While a new Ship blinks, a saucer’s shot flies straight through it. The Ship keeps its place.
Saucer Spawner sends a saucer whenever none is flying, a little sooner each wave. Saucer Flight carries it across. Saucer Gun fires, and Saucer Shot Flight points each shot, at random or at your Ship. When your Shot or your Ship sends a saucer hit, it explodes and scores.
Underneath them is one idea. The one who sends a message doesn’t decide what it means. The one who gets it does. A rock answers two messages now: hit means you broke it and the points count, and breakUp means it broke and nothing counts. And since hit ends by sending breakUp, the breaking itself is written only once, in one Event.
8.9 If It Didn’t Work
Something may be a little off the first time, and that’s normal. Run the game, wait for the siren, and watch.
Rocks you shoot don’t break anymore? Perhaps the hit Event lost the Action at its end. Look below Popup Text for a Trigger Custom Event on Object, sending breakUp, with its Applies To on Self. Then look in On Break Up. Its first block, Burst Particles, needs an arrow into it from Mode 1.
The pasted blocks won’t join On Break Up’s line? Perhaps they landed in the hit Event, because the spot you right-clicked was nearer to it. Undo the paste, and paste again from a spot right beside On Break Up’s Mode 1.
No saucer ever comes? Is Saucer Spawner attached to Game Rules, with Saucer Large and Saucer Small picked under Variables? Its timer’s name needs to be saucerCheck in both places it appears.
Two saucers at once? Look at Check Instance Count. Its Object should read tag:Saucer, so it counts both kinds.
The saucer stops crossing when it weaves? Its nextWeave Event’s Set Velocity has something in the X Velocity box. Empty it.
The saucer flies dead level all the way? Perhaps nextWeave never starts again. The last Action of its own Event restarts it, by the same name.
The siren wails on after the saucer is gone? Saucer Flight needs its When Destroyed Event, with Control Sound on Stop, to end Saucer Siren when it goes.
An Orb breaks a rock, and the score goes up? Saucer Shot Flight is sending the rock hit, when it should send breakUp.
Your Shots still pass through the saucer? Check both sides. The Shot’s Collide Only With list needs Tagged Saucer, the saucer’s needs Shot, and Shot Impact’s Collision Target needs Any Object.
Your Events kept older names, like When Starting to Hit Asteroid? That happens if you started from Chapter 7’s download, and it’s fine. A name is only a label. What counts is the Any Object in each Collision Target, so look there.
An Orb shoves your blinking Ship along? Look at On Shield Up’s Change Component Value. It needs self.collider.trigger and true, with an arrow into it from Switch Mode.
The Lances fly off at random? Look at Saucer Lance’s Variables, and set aimed to Yes.
Each of these is a small fix. Make it, run the game again, and you’re back with the chapter. The catch-up download in the Goal is this chapter, finished, if you’d like to compare.
What would make a saucer frightening to you? Set firstSeconds to 3 in Game Rules’ Variables, and one comes before you’ve settled in. Give the Orb its aim with aimed Yes, then widen aimSpread to 30, and its shots are aimed but wild. Or trade the guns, and give the large saucer the Lance. Chapter 9 is written for the card’s numbers. Set them back before you go on, and write yours down if you’d like to keep them.
Still stuck? Search the manual, or ask in the Myth Engine Discord (opens a new tab).
The field fights back now, and you can answer it. In Chapter 9, the game gets its front door, a pause, and an ending.
