- Learn
- Build a Game
- Pacific Wings
- 1 The Fighter Flies
1 The Fighter Flies
One navy-blue Fighter waits low in the middle of an empty sea. By the end of this chapter, it flies wherever you steer it, leans into its turns, and never leaves the view.
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 2 from it.
To open it, start Myth Engine, choose File › Open Project... and pick the downloaded file.
1.1 The Idea
The sea fills the screen. It’s deep blue at the top and lighter toward the bottom, and nothing is on it yet. There’s no carrier, no island and no enemy.
One Fighter waits low in the middle, its nose to the north. It’s navy blue, with cream wingtips, a gold propeller and a glass canopy.
By the end of this chapter, it flies. Hold an arrow key, and it goes that way at once, leaning a little into the turn. Let go, and it stops and levels out. Push it toward an edge, and it stops there, as if it had met a wall.
And the whole time, it’s flying north. Pacific Wings is played on a route, one long Scene that runs north from the carrier to the Command Bomber at its far end. A camera carries the Fighter up the route at a slow, steady pace. That steady movement north is the scroll.
Pacific Wings measures its world in meters, and Y counts upward, so a bigger Y is further north. The camera sees a piece of the route 20 meters across and 15 meters up. That piece is the view. The game draws it 640 pixels wide and 480 tall, then scales it up to fill its window.
The view is like a picture frame held over the sea. The frame moves north, and the Fighter moves with it, so it stays in the picture.
One thing you won’t see in this chapter is the scroll. The frame moves, but nothing on the route slides past it yet. The sea is the same blue wherever the camera goes, and it stays put on the screen. Out on open water, with no land in sight, you can’t tell you’re moving either. But the Fighter is moving, 2.25 meters every second. In Chapter 3 the first enemies wait along the route, and you’ll watch them come into the frame at the top.
You’ll build very little of the flying by hand. Myth Engine comes with Logic Components that are already made, and this chapter uses one of them, Vertical Shooter Controls.
Your keys reach it through a Command, one named control that several keys can work. This one is called Move. It holds the arrow keys and W, A, S and D, and the Logic only ever asks it one thing: which way are you pointing? It never asks which key is down.
The Fighter still picks its own numbers for Vertical Shooter Controls. They’re the Logic Component’s Shared Variables, values it keeps on each Object it’s attached to. Each Object can set its own. These say how fast the Fighter steers, how fast it flies north and how far it leans. Those numbers are how it feels under your hands.
1.2 The Plan
Here’s how the pieces work together. The game runs one step at a time, one tick of its clock, many times a second. Read each line from left to right.
- Every step -> Vertical Shooter Controls moves the camera north at scrollSpeed, and the Fighter along with it.
- An arrow key is held -> Move points that way -> Vertical Shooter Controls steers the Fighter that way at moveSpeed, and leans it by bankAngle.
- The key is let go -> Move points nowhere -> the Fighter levels out and rides north with the camera.
- The Fighter reaches an edge of the view -> Vertical Shooter Controls holds it at that edge.
1.3 Set Up
Every game starts as an empty project, and an empty project is a strange thing to look at the first time. There’s a dark Scene, a lot of buttons and no game anywhere. It fills up faster than you’d think. By the end of this chapter, a Fighter flies in it.
If you came straight here, read Before your first card first, the opening passage of Making what a card shows. It shows where things are in the editor. This chapter goes down its own cards with you, one line at a time.
In Myth, choose File > New Project…, and in the window that opens, pick Blank 2D. Type Pacific Wings as the Project Name. Myth makes a folder of that name for your project, inside the Location shown below it. If one is there already, the window says so, and Browse… picks another place. Press Create Project. Your new project opens, with its one Scene in a tab.
Next comes the Starter Kit. If you don’t have it yet, here it is.
To install it, open Myth Engine, choose File › Install Myth Pack... and pick the downloaded file.
Then, in Myth, choose File > Install Myth Pack… and pick the file you downloaded. Myth shows the kit and what it adds, with Add to This Project already chosen. It adds 30 resources. Press Install. Every picture, sound and background in Pacific Wings is in your project now, so there’s nothing to draw.
Save as you go, with File > Save or Ctrl+S. A dot beside your project’s name, at the top of the window, means there’s something new to save.
Here’s the whole card. The paragraphs after it go down it from the top.
Left Arrow, ARight Arrow, DUp Arrow, WDown Arrow, SPacific WingsSmooth TexturesMSAA (Hardware)#0C4A6ERoute · 2DART and BACKGROUND name what this chapter uses from the kit: the Fighter Art and the Ocean. The Layer line is the Ocean’s one layer, a Gradient from deep blue at the top to a lighter blue below. There’s nothing to change in it.
Leave COMMANDS for now, but read it. Move arrives by itself with Vertical Shooter Controls, later in this chapter, and you’ll come back then to check its keys. Don’t make it yourself, or you’ll have two.
The Game Settings come next. The Game Settings button above the Resources opens them in a tab of their own. Choose Display. In the Window group, the Title says My Game. Type Pacific Wings over it. That’s the name on your game’s window.
Under Rendering, Texture Filtering starts on Pixel-Art (Crisp), which keeps every pixel of a picture sharp and square. Pick Smooth Textures, so the Fighter’s edges stay soft when it’s drawn bigger or smaller than its picture. Anti Aliasing starts Off. Pick MSAA (Hardware), and the graphics card smooths jagged edges.
There’s no OK to press here. Each change holds the moment you make it, and it stays when you close the tab with the X beside its name.
Then comes the SCENE block. Your project already has one Scene, named Scene. The card calls it Route and marks it new, but you don’t need a second one. In the Resources panel, open Scenes, right-click Scene, choose Rename, type Route and press Enter.
Now the Scene’s own settings. Its tab is the one that opened with your project, and it took the new name, Route. Double-click Route in the Resources, and that tab comes to the front. Inside the tab, left of the preview, is a panel of its own, and it opens as Place Scene Content. Pick Select, the arrow above the preview, and click an empty spot in the preview. That panel turns into the Scene’s Properties.
The card starts with the camera. Scroll down to Cameras and Views and press Add View. It makes two things at once. The Main Camera chooses which part of the route is seen, in meters. The Main View places that picture on the screen, in pixels.
The Main Camera’s boxes come first. Type X 10 and Y 7.5 into its Position, the middle of what it sees. Where the card’s Camera line says view 20 x 15 m, that’s how much it sees. Type 20 and 15 into its Visible Width and Visible Height. So the camera starts out looking at the route from 0 to 20 across, and from 0 to 15 up.
The View line is the Main View. Its boxes are further down, under On-screen area, and its Camera list already says Main Camera, as the card does. Before you type, look at its Width and Height. They say 1024 and 768. The Scene editor lays out Views on a screen of its own, 1024 pixels wide and 768 tall, and a new View covers all of it. That’s the screen these boxes mean, not your monitor.
The card’s View is smaller, 640 by 480, and it belongs at the top of the editor’s screen. Your game shows a rectangle that starts at that screen’s top-left corner and stretches right and down only as far as its Views go. With the View at the top, the rectangle is the View itself. The game scales it up to fill its window. Anywhere lower, the rectangle would stretch down to reach it, with an empty band above.
Left and Bottom place the View, and they count from the other corner, the bottom-left one. Left 0 keeps the View against the left side. Bottom 288 lifts its lower edge 288 pixels up. That brings its top edge to the top of the screen, because 288 and 480 make 768.
Here the order matters. Type the Width and Height first, 640 and 480, and then Left 0 and Bottom 288. A View can’t reach past the top of the screen. While it’s still 768 tall, it has no room to rise, so a Bottom typed first doesn’t take.
Under Screen Backgrounds, open the list and pick the Ocean. That’s the card’s Background line. The Properties now show the Ocean’s own, so click an empty spot in the preview again to bring back the Scene’s.
The last line of the block is the Background Color, at the top of the Properties. Click its swatch, the small square of color. Type the card’s code into the HEX box: 0C4A6E is enough, since a # is there already. It’s a deep sea blue. It shows only where no background covers the Scene, so here it waits under the Ocean, out of sight.
The next line, Start Scene, is back in the Game Settings, under General. It already says Route · 2D, because it followed the rename by itself. PLACE THESE waits until the Fighter exists.
Your sea is ready. Run the game and look at it: press Play, the triangle at the top of the editor. A window of its own opens, called Pacific Wings, and the sea fills it from edge to edge. It’s deep blue at the top and lighter below. Press Stop, the square to the right of Play, and the window closes.
Is the sea tall and narrow instead, with blue-violet strips at its sides? Then the View’s Bottom didn’t take. Type 288 into it again, and run the game once more.
1.4 The Fighter
First comes the Fighter itself, sitting still low in the middle of the sea.
It’s a navy-blue plane, 2.88 meters across, with cream wingtips and a gold propeller. Its card has a Collider, so it’s a 2D Object. Make it with Add > Object. In the Create Object window, type Fighter as its Name, pick 2D Object as its Object Type, and press Create. The Fighter opens in a tab of its own, with a Transform and a Collider already attached. Each of those is a component, one ability the Object has. The Transform is the one every Object starts with: it says where the Object is and how big.
Here’s its whole card. The paragraphs after it go down it from the top. The Logic and the Shared Variables at the bottom come in the next part, so leave them for now.
X 2.88, Y 2.8840Fighter ArtX 2.88, Y 2.88CapsuleX 0, Y -0.09X 0.698, Y 1.7337.82.25The Transform comes first. It’s selected already in Attached Components, the list at the top right, and its Properties are open on the left. Their last section is its Bounding Box, a box the Object keeps for its own size, apart from the picture.
In the preview, the box is the cluster of round handles at the very middle, 1 by 1. Type the card’s 2.88 by 2.88 into its Size, and it opens out into a dashed square, the size the plane will be. The small green square inside it is the Collider, which comes last. Pacific Wings never reads the Bounding Box while it plays. The card sets it so your Fighter matches the finished game’s, down to the box.
Now the picture. In the Component Toolbox, at the bottom right, open the Rendering group and click Sprite. The Add Sprite Component window opens. Pick the Fighter Art in its Sprite list, if it isn’t showing already, and press Add Sprite.
The plane appears in the preview, 1 meter across for now. Attached Components lists the new Sprite under Sprites, by its picture’s name, Fighter Art, and its Properties open on the left. Near the top of them is a box labeled Scene Depth (Draw Order), the card’s Scene Depth Draw Order. Type 40 into it.
That number decides what passes over the Fighter and what passes under it. The carrier, the islands and the cloud bank of later chapters take lower numbers, and so does every enemy. They all slip under the Fighter. Tracers take higher numbers, and they fly over it.
Below that box is a section named Fighter Art, with the card’s other two Sprite lines. The Sprite line is done already. You picked the Fighter Art in the window, and the preview draws it.
The section has its own Transform, further down. This one belongs to the Sprite, and its Size is the picture’s size. It starts at 1 by 1. Type the card’s 2.88 by 2.88, and the plane grows to its full size, the same as the Bounding Box.
Last comes the Collider. It’s the part of the Fighter that can be hit, and it’s much smaller than the plane. It’s a thin Capsule down the middle, about a quarter as wide as the wings and a little over half as long as the plane. It sits a hair below the center. When enemy tracers arrive in Chapter 4, only that capsule counts, and a tracer that crosses a wingtip flies on. In Chapter 10, Focus shows it on the screen.
Select Collider in Attached Components. It starts as a Box, 1 by 1, the small green square. Under Shape and Transform, pick the card’s Shape, Capsule, and then type its Position and its Size. The green outline turns into a tall, thin shape down the middle of the plane.
Now place it, from PLACE THESE on the Set up card. Open Route and pick Place, the button beside Select. The Place Scene Content panel fills the left, and your Fighter is at its bottom, under Predefined Objects. Drag it onto the Scene. Then pick Select, click your Fighter, and type X 10 and Y 5.625 into its World Position. That’s the middle of the view across, and a little more than a third of the way up.
Run the game again. The Fighter waits low in the middle of the sea, nose up. Press any key you like, and nothing happens. That’s right, for now. Press Stop.
1.5 Flying
Now the Fighter learns to fly.
1.5.1 Vertical Shooter Controls
Hold Right, and the Fighter slides right, quick and steady, tilting a little into the turn. Let go, and it stops and levels out. Hold Up, and it climbs to the top of the view and stops there.
All of that is Vertical Shooter Controls, and it works in five small moves, one after another, at every step. First it asks Move which way you’re pointing, and sets the Fighter’s speed that way, at moveSpeed. Then it adds scrollSpeed toward the north, so the Fighter keeps up with the camera. Next it moves the camera north at that same scrollSpeed. Then it holds the Fighter in the view. Last, it leans the Fighter by bankAngle, toward whichever side it’s moving.
Let go of the keys, and two of those moves still work. The camera goes north, and the Fighter goes north with it, at exactly the same speed. That’s why it seems to hang still on the screen.
Holding the Fighter in the view is the quiet move. Nobody playing sees it work. They only feel the wall it makes at each edge of the view. It doesn’t push back, and it doesn’t steer. At every step it looks at where the Fighter is about to be. If any part of the picture would cross an edge of the view, it stops the Fighter right at that edge. So a wingtip stops at the side, and the nose stops at the top.
The card below has a fourth Shared Variable, topSafeInset. It keeps the Fighter that many meters below the top of the view. It’s 0 for now. Much later, the Command Bomber needs a strip at the top for itself.
The numbers on the card below are what every Object starts with. Leave them be. The Fighter’s own are on its card: a moveSpeed of 7.8 meters a second and a scrollSpeed of 2.25. Its bankAngle stays at the Logic’s 7 degrees, so its card leaves it off. At 7.8, the Fighter crosses the view from one side to the other in a little over two seconds. That’s quick enough to dodge, and slow enough to aim.
Make it with Add > Logic Component. Open the Starter list and pick Vertical Shooter Controls, in its Controls group. Leave the Name empty. It takes the Starter’s name. Under the list, the window shows Myth’s own description, in the engine’s words. Press Create. It brings one more thing with it, a 2D Axis Command named after itself, with the arrow keys and W, A, S and D already bound.
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.
Any ObjectThe sentence at the top of the card is this game’s own description. Your editor shows Myth’s, and that’s fine. It’s the same Logic. Under the description, the Attach to line says Any Object. This Logic can go on any Object, and in your game the Fighter is the one that carries it. The card’s last lines say it comes whole from the engine’s template, which is the Starter you picked. They also say you set its Variables on the Object. You do, on the Fighter, in a moment.
Now the Command. Open the Game Settings and choose Input Manager. The new Command is there, called Vertical Shooter Controls, a 2D Axis. Its eight keys are on the right, each with its direction, and they should match COMMANDS on your setup card. Then press the pencil beside the Command’s name, Edit Command. Type Move as its Command Name. Press Save Command. Vertical Shooter Controls still listens to it under its new name.
Now attach it. Open the Fighter. Above the preview, at the right end of its toolbar, is a list that reads Components, beside the Attached Components panel. Pick Logic in it. The panels change, and Vertical Shooter Controls waits under Compatible Logic, on the right. Click it. It joins the Attached Logic on the left.
Then switch the list back to Components. The Logic’s four Shared Variables have arrived at the top of the Properties, under Variables. Each has its own rows, with a line under them saying it came from Vertical Shooter Controls. Each Value box starts at the Logic’s number. Type the Fighter card’s two values over them: 7.8 for moveSpeed and 2.25 for scrollSpeed. Leave bankAngle and topSafeInset as they are.
Run the game, and hold an arrow key.
Your Fighter flies.
Watch for each of these.
- The game opens in a window of its own, called Pacific Wings. The sea fills it, deep blue at the top and lighter at the bottom.
- The Fighter waits low in the middle, nose up.
- Press nothing. The Fighter stays where it is on the screen. It’s flying north with the camera, and nothing on the sea shows it yet.
- Hold an arrow key, or W, A, S or D. The Fighter flies that way at once, and stops the moment you let go.
- Hold Right. The Fighter tilts a little to the right as it goes. Let go, and it levels out. Hold Left, and it tilts left.
- Hold Up and Right together, and it flies on a slant.
- Fly from one side of the view to the other. It takes a little over two seconds.
- Push into each edge. The Fighter stops with a wingtip, its nose or its tail right at the edge, and it never leaves the view.
- The scroll is the one thing you can’t watch yet, so check it where it’s set. Open the Fighter, and under Variables, at the top of its Properties, scrollSpeed’s Value reads 2.25.
A sea with a camera over it. A Fighter with a picture and a small capsule that can be hit. A Command that carries your keys, and one Logic Component that does the flying.
Underneath all of that is the picture frame from the start of this chapter, moving north over the sea. Vertical Shooter Controls carries the camera and the Fighter north by the same 2.25 meters every second. So only one thing changes where the Fighter sits in the frame. You do. Every chapter from here happens inside it. Enemies come into the frame at the top, and the carrier and the islands slide down through it.
1.6 If It Didn’t Work
Something may be a little off the first time. That’s normal, and it’s how everyone learns where things live in the editor. Run the game, watch what it does, and think it through, one piece at a time.
The game is tall and narrow, with blue-violet strips at its sides, a flat dark band across the top and a smaller Fighter? The Main View’s Bottom didn’t take. The View stayed at the foot of the editor’s screen, and the game’s rectangle still starts at the top. So the rectangle grew to 768 tall, with an empty band above the View. Width 640 and Height 480 go in first, then Left 0 and Bottom 288. Type the Bottom again now.
The sea is there, but no Fighter? Open Route and look for Fighter in the Scene Explorer, the list on the right that shows everything placed in the Scene. If it isn’t there, drag it in again from Predefined Objects. If it is, select it. Its World Position should read X 10 and Y 5.625.
Is the Fighter far too big, or far too small? Look first at the Main Camera’s Visible Width and Visible Height, under Cameras and Views. They should be 20 and 15. Then look at the Sprite’s Transform > Size, 2.88 by 2.88.
The keys do nothing? Perhaps the Logic never reached the Fighter. Open the Fighter and pick Logic in the list above its preview, and look for Vertical Shooter Controls in its Attached Logic. If it is there, look in the Input Manager, where Move needs its eight keys.
Two Commands in the Input Manager? If you made a Move of your own, Vertical Shooter Controls never listens to it. It listens only to the Command it brought. Delete yours with the red button beside its pencil, and rename the other one Move.
Each of these is one small fix. Make it, run the game again, and you’re back with the chapter. And if you’d like to compare, the catch-up download in the Goal is this chapter’s game, finished.
The Fighter’s numbers are yours to play with. Give it a moveSpeed of 15, and feel how jumpy a plane can get. Give it 4, and feel it wade. Lean it 25 degrees, like a stunt plane, or 0, like a paper cutout. Fly each one for a while, and find the Fighter that feels like yours. Write your favorites down, then put the card’s numbers back before Chapter 2, which starts from them.
Still stuck? Search the manual, or ask in the Myth Engine Discord (opens a new tab).
One Fighter flies over an empty sea, leaning into every turn. In Chapter 2, it learns to shoot.
