← Yop2D

Questions about variables, texts and data

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 most common questions about variables (score, lives, money…), texts and saves. The names in bold are the ones you see on the screen.

👉 A word you don't understand? See Yop2D words. To start: Create and use a variable.

How do I stop a variable from going past a limit?

How do I pick a random number?

How do I make an inventory?

  1. Create a game variable (GAME VARIABLES → New variable), for example sac, of type Inventory list.
  2. When the hero touches an object: If object touches Tag → Add to inventory (Object The involved object (the touched object), Variable sac). The object's name goes into the bag, only once.
  3. To check: If in inventory (outputs True / False). To remove: Remove from inventory.
  4. To show it: Object → Interface elements → Inventory grid, then Settings and style… → Or the choices of a list variable (inventory), read during the game: choose sac. Each slot shows the project image that has the object's name, otherwise its name.
👉 These nodes read the name of the chosen object: it must still be in the scene. After picking it up, hide it (Visibility: no) instead of destroying it. A full example: A key that opens a door.

How do I combine two objects (stick + cloth = torch)?

How do I make the game react when a variable changes?

How do I make a shop (buy with coins)?

  1. A game variable pieces (Whole number) and a Buy button (Object → Interactive → Button with text).
  2. On Object Click (the button) → If a variable…: pieces, is at least, Value 10 (the price).
  3. Output True → Add to Variable: pieces, -10 → Add to inventory (the sword, hidden in the scene) → Modify Text =pieces.
  4. Output False → Small message at the bottom of the screen to say there are not enough coins.
👉 Lots of items? Put the prices in a table: see Make a list of products.

How do I use a data table in a formula?

How do I write the dialogues of my game?

  1. Object → Tools → Texts and dialogues, then Open.
  2. New sentence, then give it a Sentence name (for the nodes): intro.bonjour puts the sentence in the group intro.
  3. Write the sentence in each language (button Languages to choose which ones are shown). Preview in the game shows the dialogue box.
  4. In the Blueprint: Show dialogue writes the sentence in a text object; in Say a line, tap Take from the game texts.
👉 See also Write a text in several languages and Make a character talk.

How do I ask the player for their name?

How do I change the font of a text?

How do I make a nice title?

How do I show a small message at the bottom of the screen?

How do I make a text that writes itself letter by letter?

How do I make a high score (record)?

  1. Two game variables: score and record (Whole number, 0 at the start).
  2. On Start → Load variables from a file: Save name record, Variables record.
  3. At the end of the game → If a variable…: score, is greater than, Value =record.
  4. Output True → Modify Variable: record, Value =score → Save variables to a file: Save name record, Variables record.
  5. To show it: Modify Text =record.
👉 Don't forget the = in =score: without it, the variable gets the word "score". More details: Keep the score after closing the game.

How do I erase the save (New game)?

👉 Can't find your question? Look at Where is…? and My game doesn't work.