Effect

Effect

Base class for all effect types.

Effects are transient pieces (not saved with the board) used to animate thrown items, projectiles, fire, clouds, etc. Unlike terrain/items/agents, effects are NOT immutable — they maintain frame state as they animate.

An effect has an array of animation frames (Symbols). The AnimationManager calls onTick() each frame to advance the effect.

Constructor

new Effect(name, frames, color)

Source:
Parameters:
Name Type Description
name string
frames Array.<Symbol>

animation frame symbols

color string

Classes

Effect

Members

currentSymbol

Description:
  • Current animation frame symbol.

Source:

Current animation frame symbol.

isExpired

Description:
  • True if this effect has finished animating and should be removed.

Source:

True if this effect has finished animating and should be removed.

Methods

isAboveAgent() → {boolean}

Description:
  • Should this effect render above an agent that occupies the same cell? Override to return true for effects that should appear on top.

Source:
Returns:
Type
boolean

onTick(event, board, cell)

Description:
  • Advance the effect by one tick. Called by AnimationManager each animation frame. Override in subclasses to implement movement, spreading, damage, etc.

Source:
Parameters:
Name Type Description
event GameEvent
board Board
cell Cell