← Yop2D

How to make a character jump?

Beginner guide · no code

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

For a character to jump, you need three things: it must fall (gravity), a floor to land on, and a button that pushes it upwards, only when it is standing on something.

You need:

Step 1: give the character gravity

  1. Select player.
  2. In the inspector, tap the ⚙ Object behavior button.
  3. Choose Falls and bounces: the object falls with gravity.
👉 In the same window, Gravity changes how fast it falls: Light to fall gently, Strong to fall fast. Even simpler: Platform character walks and jumps by itself, with no nodes at all (Behaviors guide).

Step 2: add a solid floor

  1. Select floor.
  2. Tap ⚙ Object behavior and choose Ground / wall: it doesn't move and stops objects that fall on it.
  3. Put player a little above the floor.
👉 You can make platforms the same way: squares set to Ground / wall placed higher up.

Step 3: the jump button

  1. Open the scene's Blueprint.
  2. Add the “On Object Click” event and choose btnJump as its target.
  3. Add the “If on ground” node (category Logic & Conditions) and choose player as its target.
  4. Add the “Impulse (jump)” node (category Movements & AI): target player, Vertical force (negative = up) = -15.
  5. Link the output of “On Object Click” to the input of “If on ground”, then the True output of “If on ground” to the input of “Impulse (jump)”.
  6. Save, then start the game and tap the button.
On Object Clicktarget: btnJump
→
If on groundtarget: player
True →
Impulse (jump)target: player · -15
👉 Why “If on ground”? Without it, the player could jump again in mid-air and fly away by tapping the button several times.
👉 Negative = upwards. In Yop2D, Y numbers grow towards the bottom of the screen. -15 makes a small jump, -20 a big one.

What about moving while jumping?

Add the left and right buttons from the guide Move a character (method 1). You can keep one finger on “right” and tap “jump” with another finger.

If it doesn't work