Skip to content

Commit b4a18e0

Browse files
AlexZ005claude
andcommitted
[docs] build-a-game: the levels chapter and the collectibles-v2 dials
- section 4 grows the optional dials: Make collectible into... (variable + respawn, built into the graph), group targeting with skip-on-regrow, the round/menu reset semantics and the leave-play visibility rule, Collect Count and the Show-collectibles-left action - new section 8: save scene as level / new scene, the Travel node (everyone travels together, the campaign carries, level collectibles start fresh), the All Players gate, and the Debug HUD element Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 2e3764e commit b4a18e0

1 file changed

Lines changed: 48 additions & 2 deletions

File tree

‎docs/build-a-game.md‎

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# Example: build a game loop
22

33
A complete worked example — a start menu, a walking character, collectibles that count
4-
into the HUD, a hold-to-peek map, and a pause menu you can click. Everything is authored
5-
in the app with the HUD editor and flow nodes. No code, no modules.
4+
into the HUD, a hold-to-peek map, a pause menu you can click, and a second level to
5+
travel to. Everything is authored in the app with the HUD editor and flow nodes. No
6+
code, no modules.
67

78
Allow about twenty minutes. Each step works on its own, so you can stop anywhere and
89
still have something playable, and every piece is visible to the people connected with
@@ -92,6 +93,24 @@ Press Play, walk up to one and click it with the crosshair. It disappears for
9293
**everyone**, the counter goes up on every screen, and clicking the empty space where it
9394
was does nothing — it stays collected.
9495

96+
A few dials, all optional:
97+
98+
- **Make collectible into…** asks which variable it counts into (existing names are
99+
offered as chips, or type a new one) and whether it **respawns** after a few seconds.
100+
The respawn is built into the graph — a Delay off the click resets the Latch and
101+
re-arms the Once — so you can see it and change it in the node editor.
102+
- Run it on a **Group** and every mesh inside becomes a collectible sharing the group's
103+
variable, as one undo step. Add a new member later and run it again: the ones that are
104+
already collectible are skipped ("2 added, 3 skipped").
105+
- Collectibles **reset when a new round starts** and when the game returns to its menu —
106+
that is the "reset each round" checkbox the recipe sets on its Latch and Once, derived
107+
from the shared round, so a Restart needs no extra wiring. And when you leave play
108+
mode, collected objects come straight back on your own screen ("only while playing"
109+
on the Visibility node), so the editor never loses an object to a running game.
110+
- **Collect Count** is the node that answers "how many are left" — it reads the
111+
collectible chains in the graph, not the score, so it is right after a respawn and
112+
after a round reset. **Actions ▸ Show collectibles left** wires it to a Text for you.
113+
95114
---
96115

97116
## 5. Hold a key to peek at a map
@@ -143,6 +162,33 @@ That's the loop: menu → play → score → pause → end → menu.
143162

144163
---
145164

165+
## 8. A second level
166+
167+
One scene is one level; a game can have many.
168+
169+
1. Build your first level, then in the **Explorer** right-click the file grid and
170+
choose **Save scene as level…**. It lands in a `Levels` folder as an ordinary
171+
`.tpscene` file. **New scene…** gives you an empty one to build the next level in.
172+
2. Where the first level should end — a door, a portal, a Finish button — add a
173+
**Travel** node (Game group) and pick the destination level on its card. Wire any
174+
trigger into it, or use **Actions ▸ Level complete — travel to a level** on a button.
175+
3. Press it and **everyone travels together**: each player loads the level themselves,
176+
and anyone missing the file pulls it from whoever has it first. The game — state,
177+
round, score variables — **carries across the hop**; the new level's own collectibles
178+
start fresh, because their little graphs live in the level file.
179+
180+
Two helpers that come with it:
181+
182+
- **All Players** (Game group) is the group-travel gate: wire in a condition each player
183+
answers for themselves ("I am standing at the portal") and it fires once **every**
184+
player in play mode says yes — spectators in the editor don't count. Feed it into the
185+
Travel node and nobody gets left behind.
186+
- The **Debug** HUD element (Display group) is a little pill for building: game state,
187+
round, elapsed time, your variables, collectibles left, who is playing and fps. Click
188+
it in-game to expand. Take it off the screen when you ship.
189+
190+
---
191+
146192
## Where to go next
147193

148194
- **[Node System](node-system.md)** — the logic nodes this example leans on: Latch,

0 commit comments

Comments
 (0)