ℹ️ 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 screens of your game (menus, levels, the end) and the interface elements: HUD, Replay and Quit buttons, lists, tabs, stars, gauges… The names in bold are the ones you see in Yop2D Next.
👉 A word you don't understand? See The words of Yop2D.
What is a HUD?
- A HUD is a scene laid over the game, like a window pane: score, lives, pause button, joystick… It has its own Blueprint.
- It does not move with the camera, it stays open when you change scenes, and it still works while the game is paused. It also works over a 3D scene.
- To make one: New scene → 2D scene, name it HUD. In the Blueprint of the game scene: On Start → Open a HUD (Scene HUD). Close the HUD closes it.
- One HUD at a time: opening another one closes the first. Full example: A pause menu.
How do I make a “Replay” button?
- Add a button (Object → Interactive → Button with text) named replay. Blueprint: On Object Click (Object replay) → Modify Variable (Variable score, Value 0) → Restart the scene.
- Restart the scene puts the objects back in place, but not the game variables (score, lives…): reset them yourself first, as above.
- If the button is in a pause menu, put Resume the game first: otherwise the scene starts again… still paused.
- To replay from the first level: Go to scene (Scene Level1) instead of Restart the scene.
How do I make a “Quit” button?
- On Object Click (Object quit) → Quit the game. The created game (APK, Google Play) closes.
- When you try it with Play, it only stops the game, like the ■ button: Yop2D stays open.
- In a web game, a page cannot close itself: the game starts again from the beginning. No need for a Quit button there.
How do I react to the phone's back button?
- If you do nothing: the back button stops the game (the created game closes).
- To choose what happens: the Back button pressed event, in the Blueprint of the scene or of the HUD. Example: Back button pressed → Pause the game, then show your pause menu (A pause menu).
- As soon as this event exists, the back button no longer closes the game: add a Quit the game button to your menu.
- If a story window (history, saves…) is open, it closes first. In a web game, the Esc key on the keyboard does the same.
How do I make a level menu (with levels to unlock)?
- One scene per level: Level1, Level2, Level3. Create a game variable level_max that is 1 at the start (Create a variable).
- In the menu scene: Object → Interface elements → Scrolling list, named menu. Settings and style… → The choices (one per line): Level1, Level2, Level3 (the exact names of the scenes).
- Blueprint of the menu: On Start → Load variables from a file.
- When an interface element changes (Object menu) → If a variable… (Variable level_max, Comparison is greater than, Value
=menu.progression) → True: Go to scene (by name) (Scene name=menu.texte). False: Show an alert window (“Not unlocked yet!”). - At the end of level 1: If a variable… (level_max is less than 2) → True: Modify Variable (level_max, 2) → Save variables to a file. Same with 3 at the end of level 2.
👉
=menu.progression is the number of the line tapped (0 for the first), =menu.texte its text. See also Keep the score after closing the game.How do I make end-of-level stars (★★★)?
- In the end scene: Object → Interface elements → Stars, named stars.
- Settings and style…: Number of stars 3, Stars lit at the start 0, and untick The player can tap the stars (to rate).
- Blueprint: On Start → Set Progress (Object stars, New progress
=score / 10). - Here, 10 points = 1 star, 30 points = 3 stars (never more than the number of stars). Change the 10 for your game.
How do I make a drop-down list (difficulty, language)?
- Object → Interface elements → Drop-down list. In the game, the player taps it: the list opens big, they pick one.
- Settings and style… → The choices (one per line): Easy, Normal, Hard. Choice at the start (0 = the 1st, -1 = none): the one shown at the start.
- The simplest: Variable that receives the value (optional) → New variable… (e.g. mode). It receives the chosen text. To react: By value (Value to test
=mode, Case 1 Easy, Case 2 Normal, Case 3 Hard). - For the game's language: choices fr, en, es… and the variable langue: sentences written in several languages follow this choice (Write a text in several languages).
- To change the list during the game: Change the choices of a list (choices separated by commas).
How do I make tabs (Options / Sound / Controls)?
- Object → Interface elements → Tabs. Settings and style… → The choices (one per line): Options, Sound, Controls.
- Place one Panel per tab (same category), named p_options, p_sound, p_controls.
- Put your buttons and texts in their panel: in the object list of the left panel, long-press the object, then drag it onto the panel (it becomes its child).
- In the tabs' Settings and style… → The panel of each tab (one object name per line, in the same order): p_options, p_sound, p_controls.
- In the game, tapping a tab shows its panel and hides the others. No node to add.
How do I make a checkbox or a single choice?
- Checkbox: yes / no (e.g. “Music”). Single choice: several choices, only one lit (Easy / Normal / Hard). Both are in Object → Interface elements.
- In Settings and style…: Variable that receives the value (optional). The checkbox puts 1 (ticked) or 0 in it; the single choice puts the text of the choice (written in The choices (one per line)).
- To react: If a variable… (checkbox: equals 1), By value (single choice), or the When an interface element changes event.
- The variable changes when the player taps the element: give it the same starting value as the element. Same with a switch: An ON / OFF switch.
How do I make a round gauge (cooldown)?
- Object → Interface elements → Round gauge, named cooldown. Settings and style…: Minimum value 0, Maximum value 100.
- Blueprint: Every frame → Add to Variable (Variable charge, Value to add 1) → Set Progress (Object cooldown, New progress
=charge). - When shooting: On Object Click (your button) → If a variable… (charge is at least 100) → True: shoot, then Modify Variable (charge, 0).
- The gauge never goes above its maximum value. For a faster cooldown, add 2 instead of 1.
How do I grey out a button (not available yet)?
- The Enable / disable an element node: Object buy, The element becomes Disable (greyed out). Enable makes it usable again, The opposite of now switches it.
- Example: When Variable Changes (coins) → If a variable… (coins is less than 10) → True: disable; False: enable.
- Greyed from the start: Settings and style… → Disabled (greyed out, doesn't react). A Button with text can also have an Image when disabled.
- Careful: when greyed, it no longer plays its sound or vibration, but On Object Click still starts. Keep the coin test in the click chain.
How do I show a message window (alert)? And for Yes / No?
- The Show an alert window node: a title, a message and only one button (OK at the start, you can change its text).
- The game pauses while the window is shown (a setting of the node). The rest of the chain starts when the player taps the button.
- For Yes / No: Ask a choice (two answers, one path for each), see Ask a question with 2 answers. Or your own window with two Button with text in a HUD, like the pause menu.
How do I make the phone vibrate?
- The Vibration node: the duration in milliseconds (100 = a small bump, 1000 = 1 second). Example: If object touches Tag (hero, enemy) → Vibration (200).
- For an interface element: Settings and style… → Vibration when tapped.
- In Menu → Create the game, the Allow the game's vibrations box must stay ticked (it is at the start). A phone without a vibrator does nothing.
How do I slow down time (slow motion)?
- The Game speed (slow motion) node: 0.5 = twice as slow, 1 = normal, 2 = twice as fast.
- Example: Game speed (slow motion) (0.3) → Wait (1) → Game speed (slow motion) (1).
- Always set it back to 1 afterwards: the speed stays until the end of the game, even after a scene change.
- For a very short hit (a blow, an explosion): Hit stop, for example 0.06 second. The game gets its speed back by itself.
How do I change the game's start screen?
- Object → Tools → Game start screen. Or Menu → Create the game → the Game start screen part → Create or edit….
- You choose: Image (background, logo), Title and text, Entry, exit and filter, Sound and duration (music), Made with Yop2D (optional). Everything saves by itself.
- It shows when the created game starts (APK, Google Play, web game), before the first scene, but not with Play: to see it, the ▶ Play button. None removes it.
- It is not the title screen with a Play button: for that one, see A title screen.
👉 To go from one screen to another: Change scenes, A transition between two scenes, Go to the next level, A settings screen, A slider and its value.