Branches and transitions
Nothing moves between the three sub-states yet. What moves a machine is a question with a cell for each answer, and those cells are branches.
Ask the question
Section titled “Ask the question”Click the Every Frame cell of Playing and add Check Mouse Button, with Button
left and When Clicked.
Notice where it went: on the parent, Playing, not on Idle. The click has to be heard whatever
the sprite is doing, and that is exactly what the last page bought you.
The branch cells
Section titled “The branch cells”The card now has two cells of its own, True and False. Every question in Hengo comes this way:
Is Near has Yes and No, Wait has Finished, and every
animated action has one too. That is why you rarely need an If wrapped around a question, the
question already branches.
Open a branch editor
Section titled “Open a branch editor”Click the True cell. A small editor opens with four things in it:
| Part | What it does |
|---|---|
| Target button | Where this branch goes. Nowhere means it stays put |
| Transition name | The text printed on the arrow in the diagram |
| + (circle) | Creates a state and points this branch at it, without leaving the editor |
| + (list) | Adds a step that runs on this branch, staying in this state |
The target and the steps are stored apart, so a branch can carry both, but not in one pass: the list + closes this editor to open the action search, and setting the target means clicking the branch cell again afterwards. The other way round, and the one the rest of this path uses, is to end the branch’s steps with a Transition action.
Either way the change of state comes last. It ends the state, so nothing after it would run.
Point it somewhere, and name it
Section titled “Point it somewhere, and name it”On the True cell’s editor, set the target to Aim and type clicked in the transition name. A
transition card appears under the branch and an arrow joins the two frames, labelled with the
name you typed. Clicking that card takes the canvas to Aim.
The name is the field people skip, and it is the one that makes the diagram worth looking at.
Playing → Aim says where; Playing → Aim reading clicked says why. In a machine with eight
states that is the difference between a diagram and a bowl of spaghetti. Name every transition in the
words you would say out loud: clicked, arrived, lost sight, out of ammo.
Watch it hop
Section titled “Watch it hop”Compile and play. Nothing visible happens yet, Aim is empty, but open the Debug tab while the
game runs and the machine hops over on every click.