Documentation

Game logic

v1 · Deprecated

Framework v1 is deprecated for new games. Existing games remain playable and editable.

Apply actions

applyActions (required)

type ApplyActionsFn<MetaData = Record<string, unknown>> =
  (gameState: GameState<MetaData>, action: Action) => void;

export const applyActions: ApplyActionsFn = (state, action) => {
  if (action.type === "SpaceClick") { /* mutate state */ }
};

Called once per legal action. MUST mutate gameState in place. See actions for the Action union; see game-state for the mutation API.

Need a hand with this?

Join our Discord