Skip to main content

Action

@zylem/game-lib


@zylem/game-lib / actions / Action

Interface: Action

Defined in: packages/game-lib/src/lib/actions/action.ts:9

Action interface -- the base contract for all actions.

Actions are entity-scoped, self-contained objects that modify entity state over time. They are ticked automatically by the entity update loop.

Properties​

done​

readonly done: boolean

Defined in: packages/game-lib/src/lib/actions/action.ts:13

Whether this action has completed


duration​

readonly duration: number

Defined in: packages/game-lib/src/lib/actions/action.ts:11

Internal duration in seconds (0 = instant, Infinity = persistent)


persistent​

persistent: boolean

Defined in: packages/game-lib/src/lib/actions/action.ts:15

Whether this action auto-removes when done (set by entity.action())

Methods​

reset()​

reset(): void

Defined in: packages/game-lib/src/lib/actions/action.ts:19

Reset the action to its initial state

Returns​

void


tick()​

tick(entity, delta): void

Defined in: packages/game-lib/src/lib/actions/action.ts:17

Advance the action by delta seconds

Parameters​

entity​

GameEntity<any>

delta​

number

Returns​

void