Skip to lesson
LESSON 26 / 44 · Beginner

Health, damage and protection

Represent player health with a normal property and control repeated hits.

Open editor in a new tab ↗

Before you begin

Place a player and one reachable enemy.

Build it step by step

  1. In the player’s custom properties, add a Number property named Health with value 3, or use Combat & interactions → Health.

  2. Create Objects touch: player touches enemy. Start with IF so the rule acts once when contact begins.

  3. Add PROPERTIES → Damage health. Choose the player’s Health property, amount 1 and protection after hit of 1 second.

  4. Add a separate IF Object property rule: Health is at most 0. Set GAME → Game over as the action.

  5. Test one hit, move away and return. Restart to restore initial values. Compare with continuous contact only after the single-hit rule works.

TRY THIS IDEA

Practical example

With 3 health, three accepted one-point hits end the game. Protection prevents other damage actions from immediately stacking during the protected interval.

Test your work

Health falls predictably and the game ends at zero.

If it does not work

Change number property directly bypasses the damage action’s protection behaviour. Use Damage health for combat rather than subtracting every tick.

MAKE IT YOUR OWN

Student challenge

Add a healing pickup that increases Health once and disappears. Decide how your rules will enforce a maximum.

Show the result to a partner. Explain what you changed and how you tested it.

Keep exploring