← Yop2D

How to win when all the coins are collected?

Beginner guide · no code

Français · English · Español · Deutsch · Italiano · Português · Русский · 中文 · 日本語 · العربية

ℹ️ 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 hero collects 3 coins. Each coin raises the score; at the third one, the Well done! message appears and the game stops.

You need:

Step 1: the hero

  1. Put an object in the scene (an image or a Square) and name it heros.
  2. Select heros, tap ⚙ Object behavior in the Inspector and choose Top-down character.
  3. Tap Object → Interactive → Joystick.

Step 2: the coins

  1. Put an object in the scene (an image or a Square) and name it piece.
  2. In the Inspector, Tag (family of objects) line, type piece.
  3. Add 2 more coins the same way (same piece tag).

Step 3: the victory message

  1. Tap Object → Texts → Text.
  2. Name it bravo and type Well done! in its Text line.
  3. Untick Visible in the game in the Inspector: it is hidden at the start.

Step 4: the score variable

  1. Left panel, Scene tab, GAME VARIABLES section: tap New variable. Name (no spaces): score; Type: Whole number; Starting value: 0. Then Apply.

Step 5: the nodes

  1. Open the Blueprint.
  2. If object touches Tag: Object heros, Tag (family of objects touched) piece
  3. Destroy Object: Object The involved object (the touched object)
  4. Add to Variable: Variable score, Value to add 1
  5. If a variable…: Variable score, Comparison is at least, Value 3
  6. True output → Visibility (Object bravo, Visible (yes / no) Yes) → Pause the game

The nodes

If object touches Tagheros · piece
→
Destroy ObjectThe involved object (the touched object)
→
Add to Variablescore · 1
→
If a variable…score · is at least 3
If a variable…
True →
Visibilitybravo · Yes
→
Pause the game

Try it

Tap Play and collect the 3 coins: each one disappears, and at the last one Well done! appears.

👉 The involved object (the touched object) = the coin the hero has just touched: one group of nodes works for every coin.