ℹ️ 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
A score that goes up and shows on screen. To try it, a +1 button gives points; then you replace it with a coin to collect.
You need:
- a 2D project open in Yop2D Next.
Step 1: the score variable
- In the 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 score text
- Tap Object → Texts → Text, place it at the top of the screen.
- Name it score_label and type 0 in its Text line.
Step 3: a button to earn points
- Tap Object → Interactive → Button with text.
- Name it plus and type +1 in its Text line.
Step 4: the nodes
- Open the Blueprint.
- On Object Click: Object plus.
- Add to Variable: variable score, Value to add 1.
- Modify Text: Object score_label, New text
=score. - Connect the three nodes in this order.
The nodes
On Object Clickplus
→
Add to Variablescore · + 1
→
Modify Textscore_label · =score
Try it
Tap Play, then the +1 button several times: the score shows 1, 2, 3…
👉
=score means: the value of the score variable. You can write =score * 10 to count 10 points per coin.👉 For a real coin to collect: replace On Object Click with If object touches Tag (see the Coins and score guide).