processInputTickfunction
Applies a complete deterministic held-input and simulation tick, releasing controls on lock or resolution.
Import it
import { processInputTick } from "@johnmorrisdotca/houseki/colour-chains";
Definition
function processInputTick(game: GameState, input: InputSchedulerState, apply: (state: GameState, action: Action) => Transition, tick: (state: GameState, ticks: number) => Transition): readonly [GameState, InputSchedulerState, readonly Transition[]]
Parameters
| Name | Type | Description |
|---|---|---|
game | GameState | The native game state used to resolve scheduled input. |
input | InputSchedulerState | The held-input scheduler state for this logical tick. |
apply | (state: GameState, action: Action) => Transition | The native applyAction function for this game. |
tick | (state: GameState, ticks: number) => Transition | The native advanceTicks function for this game. |
Returns
readonly [GameState, InputSchedulerState, readonly Transition[]]
Applies a complete deterministic held-input and simulation tick, releasing controls on lock or resolution.
Examples
import { advanceTicks, applyAction, createGame, createInputScheduler, processInputTick } from "@johnmorrisdotca/houseki/colour-chains";
const state=createGame({seed:"docs"});
const input=createInputScheduler();
console.log(processInputTick(state,input,applyAction,advanceTicks)[0].phase);fallingWhat it prints (run when this page was built)