← Yop2D

Behaviors: a character that moves without nodes

Beginner guide · no code

Français · English · Español · Deutsch · Italiano · Português · Русский · 中文 · 日本語

Before, making a character walk, jump and climb took a lot of nodes and formulas. Now you simply choose what the object does in the inspector's ⚙ Object behavior window, and the engine does the rest.

You need:

Step 1: the ground

  1. Select the ground.
  2. In the inspector, tap the ⚙ Object behavior button.
  3. Choose Ground / wall: it doesn't move, you walk on it and bump into it.
👉 For a platform you can jump through from below, also check Pass-through from below in the "It is also…" part.

Step 2: the character

  1. Select player and tap ⚙ Object behavior.
  2. Choose Platform character.
  3. In "Its settings", leave Controls: Joystick. You can choose the Speed and the Jump height.
  4. Add a Joystick to the scene. No need to choose a target: the character follows it by itself.
  5. Run the game: the joystick makes the character walk, and pushing it up makes it jump.
👉 Prefer a button to jump? Choose it in Jump button. Prefer ◀ ▶ buttons? Choose Controls: Buttons, then the left button and the right button.

Step 3: the ladders

  1. Select the ladder and tap ⚙ Object behavior.
  2. Leave Scenery and check A ladder in the "It is also…" part.
  3. Make the ladder go a little above the platform it leads to.
  4. Run the game: in front of the ladder, push the joystick up to climb and down to go down. At the top, the character lands on the platform.
👉 While climbing, the character doesn't fall: it stays hanging if you let go of the joystick. Push sideways to leave the ladder.

Step 4: the animations, by themselves

In the Animations window, give the character's animations these names: idle, walk, jump, climb and duck. The engine plays the right animation for what the character does, and flips the image when it goes left.

An enemy that walks by itself

In ⚙ Object behavior, choose Patrol (back and forth): the enemy walks on its own one way, then the other. It turns around at the edge of its ground (it doesn't fall into the void) and against a wall. It keeps gravity, and its walking animation follows its movements.

Set its Speed and Its picture faces (left or right): the library enemies face left. To make it defeat the player, follow the engine's "A patrolling enemy" mission (☰ → Step-by-step missions).

A top-down character (or iso view)

  1. Choose Top-down character in ⚙ Object behavior.
  2. In Directions, choose 4 (up, down, left, right), Iso view (4 diagonals) or Left / right.
  3. Name the animations with the direction: walk_up, walk_down, walk_left, walk_right, and idle_up… (in iso view: walk_ne, walk_nw, walk_se, walk_sw).
👉 No "left" animation? The engine flips the "right" image.

Change behavior during the game

The “Change the behavior” node offers the same choices as the window. Example: a crate set to Ground / wall starts falling when a lever is pulled: “Change the behavior” → Falls and bounces. Every setting left on "(don't change)" keeps its value.

To see the result

Download the Climb & run (platform, ladders, animations) and Dungeon walk (iso view) examples in the Examples tab of Yop2D's home screen, then tap the hero and open ⚙ Object behavior.

If it doesn't work