API Reference › Anim › Anim.fired
method

Anim.fired

Anim.fired(entity) -> bool

Returns whether an entity's SpriteAnim clip landed on the frame armed by Anim.on_frame this tick — the read side of a frame event. It is true only on the single tick the clip first reaches that cell, so a game can poll it each frame and turn it into a gameplay action (emit an event, spawn a hitbox, play a footstep). Returns false if the entity has no SpriteAnim or no event_fired field.

Parameters

entitythe entity carrying SpriteAnim

Example

program Demo {
  property SpriteAnim { ticks: int = 0, fps: int = 0, frames: int = 0, mode: int = 0, frame: int = 0, event_frame: int = 0, event_fired: int = 0 }
  model Hero { SpriteAnim }
  handler Step phase Update {
    let e = World.query_next(World.prop_id("SpriteAnim"), 0)
    if Anim.fired(e) { print(42) }      # react: footstep, hitbox, event…
  }
}
← All symbols