- Learn
- Build a Game
- Crystal Cascade
- Making What a Card Shows
Making What a Card Shows
Every piece of Crystal Cascade comes as a story and a card. The story puts the piece in your head, and the card gives its exact names and values. Read them together, then build with that picture in mind.
You don’t have to remember this page. Read the first passage, start the chapter, and come back when a card shows something new.
Before Your First Card
The Resources panel holds the things your game is made of. Its Add button makes a new resource. Choose the kind the card names, then give it the card’s name. Double-click a resource to open its editor.
Turn on Advanced Mode under Settings before building, so the Actions this game uses are available. Your game stays the same.
A card lists what you change, while fields it leaves out keep the values the editor gave them. An Action with no fields underneath still belongs in your game.
The Set Up Card
The sky comes first. ART, SOUNDS and BACKGROUND name resources from the Starter Kit, which are already in your project once you’ve installed it. The list tells you which ones this chapter uses.
COMMANDS are the controls. In Game Settings, open Input Manager and use Add Command. Give it the card’s name. Choose its Input Type, then add every key listed under Keybindings. Your Logic can then ask for Move Left without naming a keyboard key.
Input contexts keep controls together. In Input Manager, the Edit button beside a context opens Input Context Name. Rename Default there with Save Input Context. Its Commands stay with it.
Use Add Input Context to make another group, then select its row before adding its Commands. Add Command puts the Command in the selected group. Reuse a Command… adds an existing Command to that group. The keybindings belong to that context too, so copy the keys shown beneath that group on the card.
Each context has an Active at Start switch. Click it until it reads Inactive at Start when the card asks for that. Selecting a row for editing doesn’t activate its controls.
Each GAME SETTINGS heading names the page and section where its fields live, such as Display > Window. Enter the settings in the card’s order. X is horizontal; Y is vertical.
A SCENE block marked new means a Scene to make through Add. Do the Game Settings first. Then make the Scene, so its camera starts with the right proportions. Choose Start Scene last. It needs a Scene to pick from.
Open the Scene and select an empty place with the arrow tool. There are its Properties. Add the card’s sky under Screen Backgrounds, and set the camera, view and Background Color as shown. The earlier layer belongs inside the background.
PLACE THESE is the Scene’s cast. Find each Object under Predefined Objects in Place Scene Content, use its +, then enter the card’s World Position. A Screen UI placement uses an offset from its screen anchor instead.
Indented lines belong to that placement. The card names its section, such as Per Instance Variables, then the field. A placement’s Z-Index lives beside its position in Scene Properties. It overrides the Object’s draw order for that placement. Higher numbers draw in front. A switch reads On or Off. CHANGE THESE PLACEMENTS changes an Object already there, so don’t add another.
An Object Card and Its Components
An Object is a thing in the game: a crystal, a well, a word. This is the Well Cell from Chapter 1.
OnCrystal BlocksX 1.5, Y 1.5Show Well CellShow Well Cell DataEach component gives it an ability: Sprite draws its picture, while Text / UI draws its words. Collider gives it a shape, which this game’s buttons use for the mouse. Transform is there from the start.
In the Object editor, choose Components beside the preview, then click what you need in Component Toolbox. It joins Attached Components. Select it there to see its Properties. A Sprite’s Transform > Size changes the picture’s size, rather than the Object’s bounding box.
For Logic, change that same list to Logic. Choose the card’s components under Compatible Logic, in the order shown. They join Attached Logic. The handle beside each row lets you change their order later.
Some Data Structures arrive with the Logic. A card marks them From Logic. Attach that Logic and the Data Structure comes with it; don’t add another copy.
A plain Data Structure block instead asks for a component you add yourself. Choose its resource in Properties, then set its Name. Make that component before attaching its Logic. The Logic’s DATA STRUCTURES block also lists structures it needs from an existing Object. Matching names describe one component; don’t add a second copy.
The Object’s Variables section holds its Shared Variables and Per Instance Variables. A Shared Variable belongs to the Object. Its placements share it. A Per Instance Variable starts separately on every placement, so each crystal can have its own number.
Variables the Logic supplies appear when it is attached. If the Object card names another Variable, add it in the matching section. Keep its name, type and Kind as shown. Constant keeps a value fixed. Expression lets it read a formula while the game runs.
A Logic Component Card
A crystal’s picture needs behavior before it can move, fade, or change color, and Logic provides that behavior. Make a resource through Add > Logic Component. This one fades a streak of light before removing the Object that drew it.
A short-lived effect: it fades out over fadeSeconds and removes itself after removeSeconds.
Any Object- Alpha
@self.startAlpha
- Value
self.transform.opacity- Target
0- Duration
@self.fadeSeconds- Ease
Quad in
- Timer Name
"remove"- Repeat Every (s)
@self.removeSeconds- Ring Once
Yes
Copy its description into the description field if you’d like a reminder of what it does. The description is for you.
The blocks beside the Logic canvas hold its declarations, including the DATA STRUCTURES it supplies to its Object. Use the + on Data Structures, then choose the existing structure. Make the structure’s resource first. Its small name, as in self.piece, is the name expressions use.
SHARED VARIABLES and PER INSTANCE VARIABLES name values the Logic needs on its Object. Their blocks have a + for adding each declaration. Give each its type and starting value, and a Shared Variable its Kind. Attaching the Logic brings those Variables to the Object.
An Object reference also needs Object Kind, a separate setting that appears after choosing Object as its Type. It tells Myth which Object’s fields the reference can read. Keep Kind separate from it.
For example, Show Clear Name needs a reference to Game Rules. Its Shared Variables + opens a declaration form. Enter rules as Name, Constant as Kind, and Object as Type. In Object Kind, choose Game Rules, then Add. The declaration starts without a value; it tells Myth what the reference will be allowed to hold later.
Attach that Logic to Clear Name. Open the Object’s Shared Variables and set rules to Game Rules there. The declaration names the allowed Object; this later value chooses the resource to use. The card’s OBJECT KINDS section gives the declaration’s restriction.
The Logic Settings button opens the Logic’s own settings, including Attach To. Any Object keeps the Logic reusable. A card naming a particular Object there locks it to that kind.
Local values are different. A Declare Variable Action creates one where the card puts it. Later Actions use that name. It starts from its declared value again whenever the Event or Function runs. Values that survive between Events belong in a Data Structure or an Object Variable.
Events and Modes
An Event is a moment the Logic waits for, such as a key pressed or a timer ringing. Look under its heading. The When bar tells you which Event to make and which settings it needs.
Use Add Event, or the Action List’s Events group, to make it. Copy its settings, including the Command or timer name, and any Mouse button or Direction shown. Myth names it from those settings. A Custom Event is a named message, such as spawnPiece. Sending and listening must use the same spelling.
Two Actions send messages. Trigger Custom Event reaches every listener. Trigger Custom Event on Object reaches the Object its target names. With no other target, that’s the Object running this Logic. You can build a sender before any listener exists, then add that listener when the chapter reaches it.
Sometimes one Event needs different responses. Piece Gravity’s timer falls at first, then rests when the piece lands. Each response is a Mode. The card names them beneath that Event, with the starting one marked.
Use the Event’s + to make a New Mode, with the card’s Mode Name. Rename a Mode through its edit control. On the Event block, choose One at a time and its Starting Mode. Make the Modes before adding a Switch Mode Action that picks them. That Action needs something to choose.
Actions and Expressions
The numbered lines are Actions, chosen from the Action List and filled with the fields underneath. The canvas connects Actions with wires. The card’s numbers tell you their order; they aren’t labels you type.
An expression is a value worked out while the game runs. Type it as shown. A field for a sound or picture also accepts expressions, even though its suggestions list resources to pick. You can write a formula there.
Read dotted names from the left. In self.piece.row, self is the running Object, piece is its Data Structure, and row is that structure’s field. self.crystal reads a Per Instance Variable. The @ in @self.piece marks a Shared Variable instead. It can name another Object, so a longer path can continue through that Object’s Data Structure.
Change Component Value writes a Data Structure field. Its Component Value field takes the whole dotted path. Build the structure and supply or attach it before typing expressions that read it. If a name stays red, compare each part with its declaration.
Change Variable changes a declared Variable. Its Operator starts at =. That replaces the value; += adds to it, -= subtracts, and *= multiplies. A card with no Operator line keeps =. A Global Variable belongs to the whole game and has a $ before its name. Add one through the + on the Logic canvas’s Globals block.
An Action Name lets later Actions read a result, such as the column and row a Function call named myCell returns. Then myCell.column reads that column. Some cards spell the same read as actionResult("myCell", "column"); type the form the card gives.
An Applies To line names the Object an Action works on, including a new instance named by Create Instance. Keep that name when a later target refers to it.
If, Else and Repeat
An If takes one condition expression. Type the card’s comparison into its Condition field. == asks whether values match; != asks whether they differ. && means both tests must be true. With ||, either test is enough.
The Actions inside Then run when the condition is true. Else gives the other path. Add it from the Logic group beside If, and connect the branches as the card shows. Else If asks another question on that other path.
A Repeat counts its turns. While keeps running its inside Actions while its condition is true. Indentation marks the loop’s body. In a Repeat, local.index counts from zero. A card may spell that value as blockLocal("index") instead; both name the loop’s index.
A Function Card
A Function answers when another piece of Logic calls it. It has no Event of its own. Make it through Add > Function, then add its Parameters on the Start block. Each caller supplies those values for that call.
Set its Return Type in its settings before building a Return Action. Number returns one number. To return several related fields together, choose a named Data Structure; Boolean gives the caller true or false. Make that structure first, then choose it as the Return Type.
Return ends the call with its answer. Its fields follow the Return Type. A Function with no Return Type can still do a job, such as emptying the well.
An Object Parameter may require Components. Make those requirements where the Parameter names them, with the card’s slot name and schema. Now it knows which fields it may read.
A Data Structure Card
A Data Structure keeps related values together, such as the Piece’s kind, rotation and place. Make it through Add > Data Structure. Add each field with Add Field, using its name, type and default.
A Logic can supply that structure, an Object can carry it, or a Function can return it. A table can also use it for every row, and the chapter tells you which job the structure has.
A Data Table Card
A Data Table is a spreadsheet the game reads. Make it through Add > Data Table. Choose the Data Structure named in the card’s heading for its Entry Type. That structure supplies its columns.
Use Add Row to begin. The editor’s first row is numbered 1; the card calls it Row 0. The Entry name identifies it.
An IMPORT CSV card supplies a file instead. Download it, make the table with its Entry Type, and use Import CSV to choose that file. Compare the first rows with the card. A table with no rows on its card starts empty: the game’s Logic fills it later.
A Particle Effect Card
A particle effect is a spray of tiny pictures, such as crystal shards. Make one through Add > Particle. Its Properties have Emitter, Motion and Appearance pages, and the card groups its fields the same way.
A field’s section comes before its name. Open that section if it is closed. A range’s two values go into its min and max boxes. A note in brackets tells you when to set a field first, before another choice hides it.
Changes Cards
Later chapters change pieces you’ve already made. A Changes card shows the whole piece with its changes marked. Green Add lines go in, and red, struck Delete lines come out. Everything else stays as it was.
Removed steps keep their old numbers. Added steps use the new ones, so go by the marks when numbers repeat. When one field changes, its new value is green and its old value is struck beside it.
OnPieceRead The Move KeysRead The Move Keys DataSoft Drop PieceSoft Drop Piece DataDrop StreakWhen a Card and Your Game Part Ways
A value can land in the wrong box. An Action can join the wrong branch. Watch what the game does, then compare that piece with the card.
Each Goal offers a catch-up download. Extract its zip, then open the project inside with File > Open Project. You can compare the piece that misbehaves, or carry on from that working project when you’re ready. The work you’ve done still taught you where to look.
Chapter 1 starts under the blue sky.
