anim_2d
2D: frame control for the sprite's clips: per-frame durations, frame events (footsteps, the hit frame, sounds, spawned effects; each fires exactly once per crossing), per-frame hit and hurt boxes, and a state machine that picks the clip (states with priorities and cancel windows, transitions on params and buffered triggers). Runs on the actor's own clock, so hit-stop freezes it. Scripts: self.anim.fire("attack"), self.anim.set("dir", "side"), self.anim.state; onMessage 'frame' { event, value, clip, frame } and 'state' { state, from }.
In scene text
anim_2d { frame_times ["a", "b"] events ["a", "b"] boxes ["a", "b"] }Add it in the Inspector (Add Component), in scene text as above, or ask your AI. Fields you leave out keep their defaults.
Fields 8
| Field | Type | Unit / range | What it does |
|---|---|---|---|
frame_times | list of text | — | Per-frame seconds of a clip: ["attack=0.04 0.04 0.12 0.06"] (one number: every frame; fewer than frames: the last repeats). Unlisted clips keep their fps. |
events | list of text | — | Frame events "clip@frame=name" (clip-local frame, 0 first): ["run@1=footstep", "run@5=footstep", "attack@2=hit", "attack@1=sound:swing", "attack@2=spawn:slash"]. sound:NAME plays it, spawn:NAME bursts an effect; all reach scripts. |
boxes | list of text | — | Hit and hurt boxes "clip@first-last=kind x y w h" (centre x, y and size from the position, art facing right; mirrored with flip_x); "clip=..." every frame, "*=..." every clip: ["attack@2-3=hit 50 40 60 36", "*=hurt 0 40 40 80"]. |
states | list of text | — | States "name key=value...": clip (default its name; "walk_{dir}" fills in a param), priority, cancel=4-5 (frames anything may interrupt), then=idle (when a one-shot ends), speed, lock: ["idle", "run", "attack priority=10 cancel=4-5 then=idle", "hurt priority=20 then=idle"]. |
transitions | list of text | — | Checked in order, the first that holds and may interrupt wins: ["idle>run if speed>20", "run>idle if speed<=20", "*>attack on attack", "idle|run>jump if !grounded", "hurt>idle after 0.3"]. Built-in params: speed, vx, vy, grounded, climbing, wall, facing. |
start | text | — | The state it starts in (empty: the first). |
params | list of text | — | Starting params: ["dir=side", "armed=1"]. |
buffer | number | s, 0 … 2 | How long a trigger (a press) waits to be taken: input buffering, also through hit-stop. |
Arcwright Beta 2 (0.4.0) · generated from the engine source (25e375c86)Something wrong or missing? Tell us