Skip to main content

Behaviors

A behavior is ready-made movement or logic you add to an object in one tap: walk and jump, drive like a car, follow the player, spin, float up and down… Add one with Inspect → + Add behavior.

+ Add behavior
+ Add behavior
…more
…more

Each behavior card has a switch to turn it on/off and 🗑 to remove it. Events can do the same while playing (Enable/disable behavior) and change any setting (Set behavior setting); scripts use entity.behavior('platformer').speed = 8 (see live objects). In expressions: Player.behavior("platformer", "speed").

Changing settings while playing​

Every setting takes effect while the game runs, whether an event, a script or the Inspector in Play mode changes it: a Car on ice gets less Grip the moment you set it, a Platformer runs faster, a Camera follow moves to its new offset. A few details worth knowing:

SettingWhen it is changed mid-game
Car Wheels, Front wheelsThe car is built again on the newly picked wheels.
Car PathProgress and laps start over on the new path.
Car / Boat Seat, Auto seat, Auto cameraRead when someone gets in: a change applies from the next time, not to a rider already seated.
Bullet Speed (with Gravity on, on a physics body)The difference is added along its nose: a thrown object speeds up or slows down instead of being thrown again.
Wave PropertyThe property it was moving goes back to where it started, and the new one waves from there.
Wave PeriodThe wave carries on from where it is, faster or slower.
Health Max healthLowering it below the current health lowers the health to it. Raising it does not heal.
Moving platform PauseApplies from the next stop.

Switching a behavior off while playing lets go of what it was doing:

  • A Car comes off the gas and rolls to a stop.
  • A Platformer or Top-down character grips the ground instead of sliding on, and a Platformer lets go of a ladder.
  • Camera follow makes anything it had faded solid again. Switched back on, it carries on from wherever the camera is now, so you can move the camera yourself for a cutscene and hand it back.
  • Health stops blinking and hides its bar.

Behaviors in scripts​

entity.behavior('car') gives the behavior as a live object: every setting in its table below is a property to read and write (entity.behavior('car').grip = 0.3), enabled switches it, and some behaviors add readings and methods of their own:

BehaviorReadingsMethods
carspeed (m/s along its nose, negative in reverse), steerAngle (degrees), wheelCount, isOnGround, progress (laps along Path, e.g. 1.4), lapdrive(steer, gas, brake), simulateControl(…), resetUpright()
platformerisOnGround, moveAmount (0 … 1), speedY (read and write), isSwimmingjump(strength?), simulateControl(…)
topdownmoveAmount, isOnGround, isSwimmingsimulateControl(…)
boatspeed, heading (degrees), isInWaterdrive(steer, throttle), simulateControl(…)
followisChasing, targetEntity, distance (−1 without a target)
healthhealth (read and write), fraction (0 … 1, for bars), isDead, isInvincibledamage(amount, from?), heal(amount), reset()
draggableisDraggingdrop()

On a Car and a Boat, reading speed gives how fast it is going now and writing it sets the top speed.

Custom controls​

The Platformer, Top-down, Car and Boat never read the joystick or keys themselves. You pass the input in with events (or scripts), from the joystick, your own buttons, a touch wheel or any logic:

  • Car: Drive car with steer (−1 left … 1 right), gas and brake (0 … 1). With the joystick: steer joystickX, gas max(joystickY, 0), brake max(-joystickY, 0).
  • Platformer / Top-down / Boat: Move with input with x (−1 left … 1 right) and y (−1 back … 1 forward). With the joystick: x joystickX, y joystickY.
  • Any of them: Simulate control presses Left, Right, Up, Down, Jump or Handbrake for one frame, like a key.

Put the action under a Button is held condition, for example Button Gas is held → Drive car: steer 0, gas 1, brake 0. The action has to run every frame the controls are held. When it stops, the vehicle coasts and the character stops.

Make the buttons in Scene → Controls. Each button can also have keyboard keys, so you can test on a computer. A jump is On button jump pressed → Simulate control Jump.

🏃 Platformer​

Walks and jumps with the input your events or scripts pass in every frame: Move with input (x joystickX, y joystickY for the joystick) and Simulate control Jump on a button (see Custom controls). Needs a dynamic Physics body — adding the behavior adds one that doesn’t tip over, and a Collider.

SettingDefaultWhat it does
Speed5Walking speed (m/s).
Jump strength7How high it jumps.
Turn to directiononFace the way it moves.
Camera relativeon“Up” (input y) means away from the camera, not a fixed direction.
Side viewoffFor 2D games: only left / right count and it moves along the world X axis. A sprite flips to face where it goes.
ClimboffClimb ladders: climbable tiles of a tilemap, or objects tagged ladder. Up / down next to one grabs it and climbs; left / right or Jump lets go.
Climb speed3How fast it climbs (m/s).
AnimateonPlay the model’s idle / walk / sprint / jump / fall clips automatically, or a sprite’s animations named Idle, Walk, Sprint, Jump, Fall and Climb.
ControllerphysicsHow the body is moved. physics: it is a physics body pushed along by its speed, like everything else. kinematic: Rapier's character controller moves it instead, which is steadier on slopes and steps and when pushing boxes. Picked when the game starts.
Max slope50The steepest ground it can walk up, in degrees. A steeper slope stops it.
Slide slope45Standing still on ground steeper than this (degrees), it slides down. On flatter ground it stays put.
Snap distance0.5Walking down a slope or over a bump, it keeps to the ground if the ground is no farther than this below its feet (m), instead of running off into the air. 0 = off.
Step height0.3Ledges up to this high (m) are stepped onto while walking: kerbs, stairs.
Step width0.1How deep a ledge's top must be (m) to step onto it.
behavior platformer

🕹️ Top-down movement​

Moves in any direction on the ground — no jumping — with the input your events or scripts pass in every frame (Move with input, see Custom controls). For top-down, twin-stick and rolling-ball games. Works with or without a Physics body (with one, it pushes and gets blocked by things).

SettingDefaultWhat it does
Speed5Movement speed.
Turn to directiononFace the way it moves.
Camera relativeonInput directions follow the camera.
AnimateonIdle / walk / sprint clips automatically.
ControllerphysicsHow the body is moved. physics: it is a physics body pushed along by its speed, like everything else. kinematic: Rapier's character controller moves it instead, which is steadier on slopes and steps and when pushing boxes. Picked when the game starts.
Max slope50The steepest ground it can walk up, in degrees. A steeper slope stops it.
Slide slope45Standing still on ground steeper than this (degrees), it slides down. On flatter ground it stays put.
Snap distance0.5Walking down a slope or over a bump, it keeps to the ground if the ground is no farther than this below its feet (m), instead of running off into the air. 0 = off.
Step height0.3Ledges up to this high (m) are stepped onto while walking: kerbs, stairs.
Step width0.1How deep a ledge's top must be (m) to step onto it.
behavior topdown

🏎️ Car​

Gas, brake and steering come from your events or scripts (Drive car, see Custom controls): gas, brake then reverse, steer. Real ray-cast vehicle physics with suspension. Needs a dynamic Physics body.

SettingDefaultWhat it does
Speed15Top speed (m/s).
Acceleration10How fast it speeds up.
Steering30Largest steering angle (degrees).
Grip1Tyre grip. Lower = drifty, higher = sticky.
Brake1Braking strength.
Reverse speed0Top speed in reverse (m/s). 0 = 60% of Speed.
Steer rate0How fast the wheels turn toward full lock (degrees per second). 0 = default.
Steer at top speed35Percent of the full steering angle kept at top speed. 100 = the same at any speed.
Top speed ease15Percent of top speed over which the engine fades out. 0 = a hard cap, which can make the body pitch.
Suspension stiffness1Spring strength multiplier. Higher = stiffer, less dive when braking.
Suspension damping1Spring damping multiplier. Higher = settles faster, less bounce.
Wheels—Which nodes of the car model are the wheels (they spin and steer). Tap to choose; mark the front ones.
Drivermanualmanual (you drive it with Drive car from events or scripts) or ai (drives itself along the Path). Change it from events with Set behavior setting, e.g. to start a race after a countdown.
Path—Waypoint objects that form a closed racing line, e.g. #waypoint. Needed for ai. They are visited in the order of their index variable, or by name (“Waypoint 2” before “Waypoint 10”).
Seat0, 0.5, 0Where a rider sits after Enter vehicle (see Getting in and out): meters right, up, back from the car's middle.
Auto seatonEnter vehicle seats the rider and Exit vehicle puts them down beside the car. Off = do it yourself with Attach to / Detach.
Auto cameraonEnter vehicle makes cameras that follow the rider follow the car (and back on exit). Off = use Set behavior setting on the camera.

Wheels are found automatically in models whose parts are named “wheel…” (like the Kenney car kit). Otherwise pick them in Wheels; without wheels it drives on 4 invisible wheels at the corners.

With a Path, every car keeps two instance variables up to date: progress (laps driven, e.g. 1.4) and lap (the lap it is on, from 1). Compare cars' progress to work out race positions. See the Street Racer showcase.

behavior car

⛵ Boat​

Sail on Water. Your events or scripts steer it with Move with input (y forward / reverse, x steer); reverse is slower. The boat floats high on the waves, speeds up and turns smoothly, hardly drifts sideways, leans into turns and rocks gently. On land it has no power. Needs a dynamic Physics body (a Collider on Auto fits a boat model).

SettingDefaultWhat it does
Speed8Top speed (m/s). Reverse is slower.
Turn speed70How fast it turns (degrees per second) once it is moving; it turns less when nearly still, like a real boat.
Acceleration3How quickly it speeds up. With the stick released it glides to a stop.
Seat0, 0.3, 0Where a rider sits after Enter vehicle: meters right, up, back from the boat's middle (forward is negative).
Auto seatonEnter vehicle seats the rider and Exit vehicle puts them down beside the boat. Off = Attach to / Detach yourself.
Auto cameraonEnter vehicle makes cameras that follow the rider follow the boat. Off = point the camera yourself.

The boat keeps its speed in the instance variable speed (m/s). Put Camera follow on the camera with Target = the boat and Stay behind on.

:::tip Getting in and out Two event actions do the work, for a boat or a car: Enter vehicle (Player gets into Boat) and Exit vehicle. Getting in puts the player in the Seat, stops their own movement and makes cameras that follow the player follow the vehicle (turn either off with Auto seat / Auto camera). Getting out puts them down beside it — on land if one side has some — and gives it all back. The vehicle remembers its driver: the condition Has a driver is true while someone is in it.

It does not steer the vehicle. Pass the input in yourself, for example Boat has a driver (every tick) → Move with input: Boat, x joystickX, y joystickY.

With an on-screen control button named use (Scene → Controls), one event does both:

  • On button use pressed
    • sub-event: Player is in a vehicle → Player exits vehicle
    • Else + Player is touching Boat → Player enters Boat

Keep it as one event with Else: two separate events would get in and straight back out on the same press.

To show the button only where it can be used — and say what it does — add these three events (they run every frame). Show, Hide and Set label are under Input for control buttons, and under UI if you made a UI button instead (then use On clicked to press it):

  • Player is in a vehicle → Show button use, Set button use label to "Leave"
  • Else + Player is touching Boat → Show button use, Set button use label to "Board"
  • Else → Hide button use

A hidden button can't be pressed at all (not even with its keyboard key), so the player can only get in next to the boat.

A vehicle without a driver does nothing until your events give it input, so no setup is needed to keep it parked. :::

🎥 Camera follow​

Put it on the camera: it smoothly follows a target.

SettingDefaultWhat it does
TargetPlayerThe object to follow.
Offset X / Y / Z0, 6, 10Where the camera stays, relative to the target (6 up, 10 behind).
Smoothing5Higher = snappier, lower = floatier.
Look at targetonKeep pointing at the target.
Stay behindoffTurn the offset with the target’s heading — a chase camera for cars and runners.
Fade in wayoffObjects between the camera and the target turn see-through (down to Fade opacity) and fade back once they are out of the way, so walls, trees and buildings never hide the player. Only objects with a Collider count; moving ones (other cars, enemies) and the ground stay as they are.
Fade tag(empty)With Fade in way on: only objects with this tag fade, e.g. #tree so trunks turn see-through but houses don't. Empty = any object in the way.
Fade opacity0.3How see-through faded objects get: 0 = gone, 1 = not faded. Roofs over a room you look into fade well at 0.05.
Mouse lookoffLet the player turn the camera around the target: on a computer, click the game and move the mouse (Esc frees the mouse); with a gamepad, the right stick; on a phone, drag the free side of the screen. Platformer and Top-down movement follow the camera, so forward is always away from it. With Stay behind on, the camera drifts back behind the target a second after the player stops looking.
Look speed1How fast Mouse look turns. 2 = twice as fast.
Lock X / Lock YoffThe camera stays where it is along that axis: Lock Y for a side-on level that only scrolls sideways, Lock X for one that only climbs.
Use limitsoffKeep the camera inside a box, for a 2D level: it stops at the edges instead of showing empty space. With an Orthographic camera the whole view stays inside the box (a box smaller than the view is centered); with any other camera, the camera itself does.
Limit min X / max X / min Y / max Y−10, 10, −5, 10The box in world meters: the left and right edges, and the bottom and top.
behavior cameraFollow

👁️ First person​

Put it on the camera: the view sits at the eyes of a target (the player) and turns where the player looks. The player's own movement (Platformer or Top-down) is relative to the camera, so forward goes where you look.

SettingDefaultWhat it does
TargetPlayerThe object whose eyes the camera takes.
Eye height0.6How high above the target's middle the eyes are, in meters.
Offset X / Y / Z0Added to the eye position, in meters on the world axes. Change them from events, scripts or a Sine behavior for a head bob, a lean or a crouch.
Look speed1How fast the view turns. 2 = twice as fast.
Invert YoffSwap up and down for looking.
Min pitch / Max pitch−85, 85The lowest and highest the player can look, in degrees.
Turn bodyonThe target turns with the view, so it faces where you look.
Hide bodyonThe target is hidden from its own camera, so you never see inside it.

Look input: on a computer, click the game and move the mouse (Esc frees the mouse); with a gamepad, the right stick; on a phone, drag the free side of the screen. The First person template is a complete example.

👀 Look at target​

Turns a part of the object toward another object: a character's head that follows the player, a turret that tracks an enemy. It works after the animation each frame, so the animation still plays and the turn is added on top of it.

SettingDefaultWhat it does
TargetPlayerThe object to look at (it aims at the middle of it).
Bone(whole object)The part to turn: pick a bone of the object's model (for example the head), or leave it to turn the whole object.
Axis+ZWhich way that part faces in itself. If the head turns the wrong way, try -Z or another axis.
Max angle70The most it turns away from the animated pose, in degrees.
Speed8How quickly it follows: higher catches up faster, lower is smoother.
Weight1How much of the turn to use: 0 = none, 0.5 = half, 1 = all the way. Change it from a script or an event to blend the look in and out.

For a turret, leave Bone empty and set Max angle to 180.

🦾 Two-bone IK​

Bends an arm or a leg so its end reaches another object, like Unity's Two Bone IK Constraint: a hand on a door handle or a steering wheel, a foot on a step, an arm aiming at a target. It works after the animation each frame, so the rest of the body keeps animating.

SettingDefaultWhat it does
Bone—The end of the limb: a hand or a foot of the object's model. Its parent (forearm / shin) and grand-parent (upper arm / thigh) are the two bones that turn.
Target—The object the end reaches for (its middle). Usually an empty object you place, or one you move with events.
Hint target(none)An object the elbow or knee points toward: put one behind the character for an elbow, in front for a knee. Without one the limb keeps the bend its animation gave it.
Weight10 = the animated pose, 1 = fully reaching. Change it from events or a script to blend the reach in and out.
Match rotationoffAlso turn the hand or foot to the target's rotation (a hand holding a handle the way it is turned).

Out of reach, the limb stretches straight toward the target. Use one Two-bone IK per limb: two for both hands on a wheel.

➰ Follow curve​

Travels along a Curve at a steady speed. It moves the object every frame, so use it on objects without Physics, or with a kinematic body (a static body is made kinematic for you, as with a moving platform).

SettingDefaultWhat it does
Curve(this object)Which object's curve to follow, picked from a list. Empty = a Curve on the same object.
Speed4Meters per second.
ModeloopLoop starts again at the end, Ping-pong goes back and forth, Once stops at the end.
Start at0Where it starts, 0 (beginning) to 1 (end).
Face forwardonTurn to look along the curve. This is also what makes the curve's Tilt lean the object.
UprightonFace forward without pitching up or down on slopes.
PlayingonTurn off to pause.

When the Curve is on its own object, the path stays where it was when the game started, so the object doesn't drag its own track along. When it is on another object, the path moves with that object, so a curve on a moving platform carries its rider.

Events: On reached end of curve, Compare curve progress, Set curve progress and Play / pause curve (see Curve).

🔁 Repeat along curve​

Put it on an object with a Curve. It places copies of other objects along the line: fence posts, street lamps, trees along a road, coins on a path. It works like Blender's Array along a curve: you choose how many, how each copy is turned, where it sits next to the line, and what it copies.

What to copy

SettingDefaultWhat it does
Object(pick one)What to copy: another object of this scene, or a prefab.
Object 2 / Object 3(none)More objects to copy. The copies take them in turn, or at random (the Pick setting appears once you choose a second object).
Start cap / End cap(none)One object placed at the very start, and one at the very end, of an open line (a gate post at each end). A closed line has no ends.

How many

SettingDefaultWhat it does
Count modespacingspacing: a copy every Spacing meters. count: exactly Count copies, spread from start to end. fit: about every Spacing meters, but stretched a little so the last copy lands exactly on the end of the line.
Spacing2Meters between copies, measured along the line (with spacing and fit).
Count10How many copies (with count).
Start offset0Meters from the start of the curve to the first copy.

How each copy is turned

SettingDefaultWhat it does
Face forwardonTurn each copy to run along the line. Off = every copy keeps the turn of the original.
UprightonKeep copies standing up on slopes.
Align axis-ZWhich side of your object points along the line. Models face different ways: if a fence piece lies across the line, try +X or -X.
Keep rotationonEvery copy keeps the original's own turn on top of the line's turn. Turn a post 90° in the scene and every copy is turned 90° too.
Rotate X / Y / Z0An extra turn for every copy, in degrees, measured from the way it runs along the line.
Random rot X / Y / Z0Each copy turns up to this many degrees more or less, a different amount each.
Flip alternateoffTurn every second copy around, so lamps on both sides of a road face it.
Use tiltonLean copies by the curve's Tilt at that spot.

Where each copy sits

SettingDefaultWhat it does
Side / Up / Along offset0Move every copy away from the line, in meters: to its right (negative = left), up, or forward along it.
Alternate sidesoffEvery second copy goes to the other side of the line (lamps left and right).
Use scaleonSize copies by the curve's Scale at that spot.
Random scale0Each copy is bigger or smaller by up to this share: 0.2 = anything from 80% to 120%.
Seed1Changes the random picks. The same seed always gives the same result, and changing the count does not reshuffle the copies you already have.

Other

SettingDefaultWhat it does
Hide sourceonHide the original objects, so only the copies show.
LiveonWhile the game runs, place the copies again when the curve's points or these settings change (from a script, an event or a tween). Off = placed once at the start.

The copies are children of the curve object, so moving the curve moves them all. At most 500 copies are placed. In scripts, entity.behavior('repeatOnCurve').rebuild() places them again, and .count says how many there are. Copies have everything the original has (collider, physics, behaviors), so use plain objects for scenery.

The editor shows the copies too (as the object itself, or small boxes for a prefab), with the same turns, offsets and random picks, so you can move the curve's points or change a setting and watch them follow. The original is hidden only when the game runs.

🏞️ Parallax​

Put it on a background layer (hills, clouds, a far wall): it scrolls slower than the world, so it looks far away. Use one on each layer with a different Factor X.

SettingDefaultWhat it does
Factor X / Y0.5, 0How much of the camera's movement the layer copies. 0 moves with the world like any object; 1 stays glued to the camera (never seems to move, like the sky). Far layers use bigger numbers, near layers smaller ones.
Wrap width0Repeat endlessly. Put a row of copies side by side (each one picture wide), and set this to number of copies × the distance between them: when a copy leaves the view on one side it comes back on the other. 0 = no repeating.
behavior parallax

The layer starts where you put it and moves relative to that. Put background layers farther from the camera than the level (a smaller Z) and give them a lower Sort order.

↔️ Moving platform​

Slides the object from where it starts by a distance and back again, pausing at each end: lifts, bridges across a gap, platforms that sweep a pit. Whatever stands on it is carried along.

SettingDefaultWhat it does
Move X / Y / Z4, 0, 0How far it travels from its starting place, in meters. 4, 0, 0 slides 4 m to the right and back; 0, 3, 0 is a lift going up 3 m. Negative numbers go the other way.
Speed2How fast it moves (m/s).
Pause0.5Seconds it waits at each end, so the player can step on and off.
behavior mover

Put it on any object with a Collider (a sprite, a model, a tilemap). If the object has no Physics body, or a static one, the behavior makes it a kinematic one for you: it moves by itself, pushes things out of its way and is never pushed. Put it on a tilemap and the whole tilemap moves, so a small tilemap of three platform tiles is a handy moving platform. Tick One-way platform on its Collider (or use one-way tiles) so the player can also jump up through it from below.

How riders are carried. A character that stands on the platform moves with it: sideways, up and down, and the character's own walking and jumping still work on top. A character that is not on it (jumping, or beside it) is only pushed if the platform runs into it. When you jump off, the jump starts from the character's own speed (it doesn't inherit the platform's).

You can turn it on and off with events (Enable / disable behavior, mover), for example a lift that only runs after a switch is pressed. The 2D Platformer template has one over the wide gap.

🔄 Rotate​

Spins constantly — coins, fans, windmills, planets.

SettingDefaultWhat it does
Speed X / Y / Z0, 90, 0Degrees per second around each axis.
behavior rotate

➤ Bullet​

Keeps moving forward (its −Z direction) — bullets, arrows, rockets, moving obstacles. Spawn it facing the right way (e.g. Create object at the gun, then Set angle).

SettingDefaultWhat it does
Speed10Meters per second.
GravityoffFalls over time (arrows, cannonballs).
behavior bullet

〰️ Wave (sine)​

Smoothly moves back and forth forever — floating pickups, bobbing boats, moving platforms, pulsing lights.

SettingDefaultWhat it does
PropertyyWhat waves: x, y, z, angle, scale or opacity.
Magnitude0.5How far (meters; degrees for angle).
Period2Seconds for one full wave.
behavior sine

🎯 Follow target​

Moves toward another object — chasing enemies, pets, homing missiles.

SettingDefaultWhat it does
TargetPlayerWhat to follow.
Speed2Meters per second.
Stop distance1Stops this close.
Look atonFace the target.
AnimateonWalk / idle clips automatically.
PathfindingoffWalk around walls, rocks and buildings instead of pushing into them. It finds a way round anything static (a Physics body set to Static, with a Collider), re-plans as the target moves, and stands at the closest spot when the target can't be reached. Other moving objects don't count. Works on flat ground; it doesn't plan jumps or stairs between floors.
behavior follow

Walk to a point​

To send something to a spot instead of after an object, use the Move to position action (Object group): it walks there over the next frames, around walls when Go around walls is on, and On arrived runs when it gets there (or as close as it can). Stop moving cancels it, and Is moving to a position is true on the way. It works with or without a Physics body; a movement behavior on the same object waits while it walks, and the joystick takes over again at once. A model plays its walk clip on the way (sprint above Sprint above speed, 6 by default) and idle when it stops; turn off Play walk / idle animations to play your own.

Tap to move — two rows, with the spot under the finger from touchWorldX / touchWorldZ:

On screen tapped → Move Player to (touchWorldX, touchWorldZ) at speed 4
On Player arrived → Play sound "Click"

A patrol: On Guard arrived → Move Guard to the next point. In scripts: entity.moveTo(x, z, speed), entity.stopMoving(), and game.touchWorld() for the tapped spot (the Tap to move snippet).

🗑️ Destroy when far​

Removes the object when it falls or goes too far — keeps games with many bullets or spawned obstacles fast.

SettingDefaultWhat it does
Kill Y−20Destroyed when it falls below this height.
Max distance200Destroyed this far from the camera (0 = never).
behavior destroyOffscreen

✋ Draggable​

The player can drag it with a finger — puzzles, sorting games, placing things.

SettingDefaultWhat it does
Axisxzxz = along the ground, xy = up/down and sideways (facing the camera), or a single axis x, y, z.
behavior draggable

❤️ Health​

Gives the object health: it loses some with the Damage action, gets it back with Heal, and dies at 0. Use it for the player's lives, enemies that take several hits, crates that break.

SettingDefaultWhat it does
Max health3Health at the start, and the most Heal gives back.
Invincible time0.5Seconds after a hit when more damage does nothing, so one touch doesn't cost several lives. 0 = every hit counts.
FlashonBlink while invincible.
Knockback0Push it away from what hit it (the From object of Damage), in m/s. Needs a dynamic Physics body.
Show baroffA small health bar floats above it once it is hurt: green, then orange, then red.
Destroy on deathonRemove it at 0 health, right after its On death event. Turn off for the player, to show a game over screen instead.
behavior health

Health is kept in the object's own variable health, so you can show it (Player.health in a slider) or compare it like any variable. Setting health above 0 again brings a dead object back, e.g. on respawn.

In the event sheet, Health has:

  • Damage amount (from object) and Heal amount — actions.
  • On hurt and On death — conditions that run when it happens. The object is still there during On death, so you can play an explosion at it and add its points.
On Bullet collides with #enemy → Damage #enemy by 1 (from Bullet), Destroy Bullet
On #enemy death → Spawn particles "explosion" at #enemy, add #enemy.points to Score

Damage first, then destroy the bullet: a destroyed object can't be the From of the knockback. In scripts: entity.damage(1, bullet), entity.heal(1).