ℹ️ For Yop2D Next, the new 2D + 3D version of Yop2D (coming soon). Button and node names are those of Yop2D Next.
🔍 How do I…? All short recipes, with a search
The score is written to a file each time a point is won, and read back at the start: it comes back even after closing the game.
You need:
- a 2D project open in Yop2D Next.
Step 1: the score variable
- Left panel, Scene tab, GAME VARIABLES section: tap New variable. Name (no spaces): score; Type: Whole number; Starting value: 0. Then Apply.
Step 2: the text
- Tap Object → Texts → Text.
- Name it score_label and type 0 in its Text line.
Step 3: a button to try it
- Tap Object → Interactive → Button with text.
- Name it plus and type +1 in its Text line.
Step 4: the nodes
- Open the Blueprint.
- On Start → Load variables from a file: Variables (empty = all) score
- Loaded output → Modify Text (Object score_label, New text
=score) - On Object Click: Object plus → Add to Variable: Variable score, Value to add 1 → Modify Text (
=score) → Save variables to a file: Variables (empty = all) score
The nodes
On Start
→
Load variables from a filescore
Loaded →
Modify Textscore_label · =score
On Object Clickplus
→
Add to Variablescore · 1
→
Modify Text=score
→
Save variables to a filescore
Try it
Tap Play, then +1 three times: the score is 3. Stop the game and play it again: it still shows 3.
👉 For a high score: make a second variable record and save only that one. The Save name setting lets you have several saves.