AnimationProxy

AnimationProxy

AnimationProxy — bridges immutable piece singletons and their per-position animation state (frame counter).

Mirrors Java's AnimationProxy: every animated piece placed on the board gets its own proxy that tracks (x, y) and an independent frame counter. The piece itself stays immutable; the proxy carries the mutable frame state.

The Board maintains a list of these; AnimationManager walks the list each tick instead of scanning every cell.

Constructor

new AnimationProxy(x, y, piece, randomSeed)

Source:
Parameters:
Name Type Default Description
x number
y number
piece object

an agent or terrain with an onFrame method

randomSeed boolean true

if true, start at a random frame offset

Classes

AnimationProxy

Methods

proxyFor()

Description:
  • True if this proxy represents the given piece at the given position.

Source:

setXY()

Description:
  • Update position without destroying/recreating the proxy (used when an agent moves to an adjacent cell).

Source:

tick(event, board)

Description:
  • Execute one animation frame: call piece.onFrame with the current counter, then increment it.

Source:
Parameters:
Name Type Description
event GameEvent
board Board