Components
Every component that game data can use, by name, with its default values. Put them in prefab or entity
components objects; omitted fields keep their defaults. Generated from the source (pnpm docs:llms).
Component Body
Section titled “Component Body”A moving body. Velocity is in pixels per second; the physics system integrates it every fixed step
and resolves collisions. Contact flags (onFloor…) are outputs, recomputed every step.
Example: world.add(player, Body, { maxFallSpeed: 600 }); if (input.pressed(‘jump’) && world.get(player, Body).onFloor) world.get(player, Body).vy = -380;
| Field | Default | Notes |
|---|---|---|
vx |
0 |
|
vy |
0 |
|
gravityScale |
1 |
Multiplier on world gravity (0 = floats). |
maxFallSpeed |
900 |
Terminal downward speed (px/s). |
dragX |
0 |
Horizontal deceleration toward 0 when no other system sets vx (px/s²). 0 = none. |
collideTiles |
true |
Collide with tiles. |
collideWorldBounds |
true |
Keep inside the tilemap’s left/right/top edges. |
dropThrough |
false |
Fall through one-way platforms this step (set by controllers for “down + jump”). |
onFloor |
false |
|
onCeiling |
false |
|
onWallLeft |
false |
|
onWallRight |
false |
|
onSlope |
false |
Package: @ludrel/physics-arcade
Component Brain
Section titled “Component Brain”An NPC driven by a brain document (game/ai/<id>.json): a state machine or a behaviour tree.
| Field | Default | Notes |
|---|---|---|
brain |
"" |
|
speed |
0 |
Walking speed override (0 = the brain’s speed). |
Package: @ludrel/framework
Component Checkpoint
Section titled “Component Checkpoint”Touching it makes it the respawn point (emits checkpoint:reached once) and plays its activeAnimation.
| Field | Default | Notes |
|---|---|---|
targetTag |
"player" |
|
activeAnimation |
"active" |
|
active |
false |
Output. |
Package: @ludrel/framework
Component Collider
Section titled “Component Collider”Axis-aligned collision box relative to the entity’s Transform. Without a Body it is static:
solid statics block bodies like tiles, oneWay ones only from above, and trigger colliders only
report overlaps.
Layers: layer is this collider’s layer name; mask lists layers it interacts with (* = all).
To change a mask at runtime assign a new array (masks are cached per array).
Example: world.add(coin, Collider, { w: 8, h: 8, offsetX: 4, offsetY: 4, layer: ‘pickup’, mask: [‘player’], trigger: true });
| Field | Default | Notes |
|---|---|---|
w |
16 |
|
h |
16 |
|
offsetX |
0 |
|
offsetY |
0 |
|
layer |
"default" |
|
mask |
["*"] |
|
trigger |
false |
|
solid |
false |
|
oneWay |
false |
Package: @ludrel/physics-arcade
Component ContactDamage
Section titled “Component ContactDamage”Hurts entities with targetTag on contact. If stompable, landing on top defeats this entity instead
(emits enemy:stomped) and bounces the stomper.
Example: (prefab JSON) “ContactDamage”: { “amount”: 1, “stompable”: true }
| Field | Default | Notes |
|---|---|---|
amount |
1 |
|
targetTag |
"player" |
|
stompable |
true |
|
bounce |
240 |
Upward speed given to the stomper (px/s). |
Package: @ludrel/framework
Component Health
Section titled “Component Health”Hit points with a short invulnerability after each hit. At 0 the entity dies: <name>:died is emitted
and a controlled entity (PlatformerController) pops up and falls off screen until respawn revives it.
Example: (prefab JSON) “Health”: { “hp”: 3, “max”: 3 }
| Field | Default | Notes |
|---|---|---|
hp |
3 |
|
max |
3 |
|
invulnerableTime |
1.2 |
Seconds of invulnerability after a hit (the sprite blinks). |
knockback |
150 |
Speed of the knockback after a hit (px/s). |
invulnerable |
0 |
Output: seconds of invulnerability left. |
dead |
false |
Output: true from death until respawn. |
Package: @ludrel/framework
Component Hover
Section titled “Component Hover”Floats around its starting point (flying enemies, moving pickups). Moves the Transform; no Body needed.
| Field | Default | Notes |
|---|---|---|
rangeX |
32 |
Horizontal travel each side of the start (px). |
rangeY |
6 |
Vertical bobbing each side of the start (px). |
period |
3 |
Seconds for one horizontal round trip. |
bobPeriod |
1 |
Seconds for one bob. |
phase |
0 |
Starting offset in the cycle (0..1), so neighbours don’t move in sync. |
Package: @ludrel/framework
Component Interactable
Section titled “Component Interactable”Something the player can talk to or use: pressing the interact action nearby starts dialogue (if any) and
emits talked:<name> and event (if any). Shows prompt above it while the player is in range.
| Field | Default | Notes |
|---|---|---|
dialogue |
"" |
|
event |
"" |
|
range |
24 |
|
prompt |
"" |
|
targetTag |
"player" |
Tag of who can interact. |
Package: @ludrel/framework
Component KeepInView
Section titled “Component KeepInView”| Field | Default | Notes |
|---|---|---|
margin |
2 |
Component Lifetime
Section titled “Component Lifetime”Despawns the entity after seconds (effects, banners, defeated enemies).
| Field | Default | Notes |
|---|---|---|
seconds |
1 |
Package: @ludrel/framework
Component Mover
Section titled “Component Mover”Moves an entity by itself (Transform, no Body needed): line at (vx, vy); sine and zigzag sway sideways by
amplitude every period seconds while moving at (vx, vy); dive drifts for delay seconds, then speeds toward
where the player was.
| Field | Default | Notes |
|---|---|---|
pattern |
"line" |
|
vx |
0 |
|
vy |
40 |
|
amplitude |
24 |
|
period |
2 |
|
delay |
1 |
|
speed |
140 |
Speed of a dive (px/s). |
time |
0 |
Output: seconds since it started moving. |
Package: @ludrel/framework
Component Name
Section titled “Component Name”| Field | Default | Notes |
|---|---|---|
value |
"" |
Component NetPlayer
Section titled “Component NetPlayer”Marks an entity as an online player’s: its controls read that player’s inputs (ADR 0027).
| Field | Default | Notes |
|---|---|---|
index |
0 |
|
name |
"" |
Output: the player’s name (their handle), set when the match starts. |
Package: @ludrel/input
Component Offscreen
Section titled “Component Offscreen”| Field | Default | Notes |
|---|---|---|
margin |
32 |
Component Parallax
Section titled “Component Parallax”A repeating background image that scrolls at a fraction of the camera’s speed. Needs no Transform.
Example: world.add(world.spawn(), Parallax, { texture: ‘bg.hills’, scrollX: 0.3, offsetY: 40, z: -10 });
| Field | Default | Notes |
|---|---|---|
texture |
"" |
|
scrollX |
0.5 |
0 = fixed to the screen, 1 = moves with the world. |
scrollY |
0 |
|
repeatX |
true |
|
repeatY |
false |
|
offsetX |
0 |
|
offsetY |
0 |
|
alpha |
1 |
|
visible |
true |
|
z |
0 |
Package: @ludrel/render-2d
Component ParticleEmitter
Section titled “Component ParticleEmitter”| Field | Default | Notes |
|---|---|---|
texture |
"" |
|
color |
"#ffffff" |
|
size |
2 |
|
rate |
20 |
|
burst |
0 |
|
emitting |
true |
|
lifetime |
[0.4,0.8] |
|
speed |
[20,60] |
|
angle |
[0,360] |
|
gravity |
0 |
|
scale |
[1,0] |
|
alpha |
[1,0] |
|
maxParticles |
200 |
|
offsetX |
0 |
|
offsetY |
0 |
|
z |
0 |
Component Patrol
Section titled “Component Patrol”Walks back and forth, turning at walls and (optionally) ledges. Needs a Body.
| Field | Default | Notes |
|---|---|---|
speed |
30 |
|
direction |
-1 |
-1 = left, 1 = right. |
turnAtLedges |
true |
Package: @ludrel/framework
Component Pickup
Section titled “Component Pickup”Collected when an entity with targetTag touches it: emits pickup:<kind> (count it with rules), heals
by heal, bursts a few particles and disappears. The scene state gets <kind>Total (pickups of that kind
at scene start), handy for “Coins 3/20”.
| Field | Default | Notes |
|---|---|---|
kind |
"coin" |
|
targetTag |
"player" |
|
heal |
0 |
|
item |
"" |
An item (manifest items) the collector gets. |
effectColor |
"#ffe066" |
Particle colour of the collect effect (empty = none). |
Package: @ludrel/framework
Component PlatformerAnimator
Section titled “Component PlatformerAnimator”| Field | Default | Notes |
|---|---|---|
idle |
"idle" |
|
run |
"run" |
|
jump |
"jump" |
|
fall |
"fall" |
|
hurt |
"hurt" |
Component PlatformerController
Section titled “Component PlatformerController”Side-scroller controls: run with acceleration, variable-height jump, coyote time, jump buffering, optional multi-jump, and drop through one-way platforms with down + jump. Reads input actions by name.
Example: (prefab JSON) “PlatformerController”: { “speed”: 110, “jumpSpeed”: 320, “maxJumps”: 2 }
| Field | Default | Notes |
|---|---|---|
enabled |
true |
When false the controller leaves the body alone (cutscenes, death, level clear). |
moveAction |
"moveX" |
|
jumpAction |
"jump" |
|
downAction |
"down" |
Optional action for dropping through one-way platforms (with jump). |
speed |
110 |
Max horizontal speed (px/s). |
acceleration |
1400 |
|
deceleration |
1800 |
|
airControl |
0.65 |
Fraction of acceleration available in the air. |
jumpSpeed |
320 |
|
jumpCut |
0.45 |
Upward speed is multiplied by this when jump is released early (shorter hops). |
coyoteTime |
0.1 |
Seconds after leaving a ledge during which jumping still works. |
jumpBuffer |
0.12 |
Seconds a jump press is remembered before landing. |
maxJumps |
1 |
|
facing |
1 |
Output: 1 = facing right, -1 = left. |
state |
"idle" |
Output: idle |
Package: @ludrel/framework
Component Projectile
Section titled “Component Projectile”A bullet: hurts the first entity with Health and targetTag it touches, then disappears.
| Field | Default | Notes |
|---|---|---|
damage |
1 |
|
targetTag |
"enemy" |
Package: @ludrel/framework
Component Rect
Section titled “Component Rect”A solid coloured rectangle — handy for prototypes, placeholder art and UI.
| Field | Default | Notes |
|---|---|---|
w |
16 |
|
h |
16 |
|
color |
"#ffffff" |
|
offsetX |
0 |
|
offsetY |
0 |
|
alpha |
1 |
|
visible |
true |
|
z |
0 |
|
space |
"world" |
screen keeps it fixed on screen (HUD panels, dimmers). |
Package: @ludrel/render-2d
Component Score
Section titled “Component Score”Adds points to a counter (session.score by default) when the entity is defeated (its Health reaches 0).
| Field | Default | Notes |
|---|---|---|
points |
100 |
|
counter |
"score" |
|
effectColor |
"#ffb347" |
Particle colour of the explosion (empty = none). |
sound |
"" |
Package: @ludrel/framework
Component Shooter
Section titled “Component Shooter”Fires bullet prefabs: automatically, or while action is held. direction is up, down or player (aimed);
count bullets fan out over spread degrees.
| Field | Default | Notes |
|---|---|---|
bullet |
"" |
|
rate |
4 |
Shots per second. |
action |
"" |
Input action that fires while held; empty = fires by itself. |
speed |
200 |
|
direction |
"up" |
|
count |
1 |
|
spread |
0 |
|
offsetX |
0 |
|
offsetY |
0 |
|
sound |
"" |
|
delay |
0 |
Seconds before the first automatic shot (enemies wait a little after appearing). |
enabled |
true |
|
cooldown |
0 |
Output: seconds until it can fire again. |
Package: @ludrel/framework
Component Sprite
Section titled “Component Sprite”Draws a texture (or one frame of a sprite sheet) at the entity’s Transform.
Use anchorX/anchorY 0.5 for sprites that flip, so they flip around their center.
Example: world.add(player, Sprite, { texture: ‘player.sheet’, frame: 0, anchorX: 0.5, anchorY: 1 });
| Field | Default | Notes |
|---|---|---|
texture |
"" |
Asset key of an image, tileset or sprite sheet. |
frame |
-1 |
Frame index for sprite sheets; -1 draws the whole texture. |
anchorX |
0 |
|
anchorY |
0 |
|
offsetX |
0 |
|
offsetY |
0 |
|
flipX |
false |
|
flipY |
false |
|
tint |
"#ffffff" |
|
alpha |
1 |
|
visible |
true |
|
z |
0 |
Draw order within the layer; higher is in front. |
space |
"world" |
screen keeps it fixed on screen (HUD icons). |
Package: @ludrel/render-2d
Component SpriteAnimation
Section titled “Component SpriteAnimation”Plays a named animation from the sprite sheet used by the entity’s Sprite (animations are declared in
the manifest’s asset entry). Set animation to switch; time restarts automatically.
Example: world.get(player, SpriteAnimation).animation = body.onFloor ? ‘run’ : ‘jump’;
| Field | Default | Notes |
|---|---|---|
animation |
"" |
|
speed |
1 |
|
playing |
true |
|
finished |
false |
Output: true when a non-looping animation reached its last frame. |
Package: @ludrel/render-2d
Component Tags
Section titled “Component Tags”| Field | Default | Notes |
|---|---|---|
values |
[] |
Component Text
Section titled “Component Text”Text at the entity’s Transform. space: 'screen' keeps it fixed on screen (HUD).
If font is the key of a loaded bitmap font (asset type font), the text is drawn with it, scaled by
the whole number nearest to size / glyph height (crisp pixel text); otherwise font is a CSS font family.
Example: world.add(e, Text, { text: ‘Coins 3’, font: ‘font.main’, size: 8, shadow: ‘#000000’ });
| Field | Default | Notes |
|---|---|---|
text |
"" |
|
size |
12 |
|
color |
"#ffffff" |
|
align |
"left" |
|
font |
"monospace" |
|
shadow |
"" |
Bitmap fonts only: drop-shadow colour (empty = none). |
space |
"screen" |
|
alpha |
1 |
|
visible |
true |
|
z |
100 |
Package: @ludrel/render-2d
Component TopDownAnimator
Section titled “Component TopDownAnimator”Picks the sprite animation for top-down characters (players and NPCs): <walk>-<facing> while moving, else
<idle>-<facing> (facing is down, up, left or right). With directional: false it plays <walk> or
<idle> and flips the sprite to face left.
| Field | Default | Notes |
|---|---|---|
idle |
"idle" |
|
walk |
"walk" |
|
directional |
true |
|
facing |
"down" |
Output, also set from movement for NPCs. |
Package: @ludrel/framework
Component TopDownController
Section titled “Component TopDownController”Eight-way movement from two axis actions (top-down games). Faces the way it last moved.
| Field | Default | Notes |
|---|---|---|
enabled |
true |
|
moveXAction |
"moveX" |
|
moveYAction |
"moveY" |
|
speed |
80 |
|
acceleration |
900 |
|
facing |
"down" |
Output: down, up, left or right. |
Package: @ludrel/framework
Component Transform
Section titled “Component Transform”Position (pixels, world space), rotation (radians) and scale of an entity. Physics, rendering and cameras all read this component.
Example: world.add(player, Transform, { x: 32, y: 80 });
| Field | Default | Notes |
|---|---|---|
x |
0 |
|
y |
0 |
|
rotation |
0 |
|
scaleX |
1 |
|
scaleY |
1 |
Package: @ludrel/core
Component Transform3D
Section titled “Component Transform3D”Position (metres; y is up), rotation (degrees around x, y, z) and scale of a 3D entity. 3D physics, rendering and cameras read it.
Example: world.add(gem, Transform3D, { x: 2, y: 1, z: -4 });
| Field | Default | Notes |
|---|---|---|
x |
0 |
|
y |
0 |
|
z |
0 |
|
rx |
0 |
|
ry |
0 |
|
rz |
0 |
|
sx |
1 |
|
sy |
1 |
|
sz |
1 |
Package: @ludrel/core
Component Trigger
Section titled “Component Trigger”A zone that emits trigger:<event> on the world’s event bus when a matching entity enters it.
Created from level trigger objects.
| Field | Default | Notes |
|---|---|---|
event |
"" |
|
filterTag |
"" |
Only entities with this tag fire it (empty = any body). |
once |
false |
Package: @ludrel/framework