Skip to content

1681-engine / index / stickToAxis

Function: stickToAxis() ​

ts
function stickToAxis(v, deadZone?): object;

Defined in: src/input/stickAxis.ts:35

The keyboard-shaped axis for a stick vector: each of dx, dy is -1, 0 or 1 (screen y grows downward, as the keyboard's "down" does), nothing inside the dead zone, and the nearest of the eight directions otherwise.

Parameters ​

ParameterTypeDefault value
vStickVectorundefined
deadZonenumberSTICK_DEAD_ZONE

Returns ​

object

dx ​

ts
dx: number;

dy ​

ts
dy: number;

Released under the MIT License.