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 ​
| Parameter | Type | Default value |
|---|---|---|
v | StickVector | undefined |
deadZone | number | STICK_DEAD_ZONE |
Returns ​
object
dx ​
ts
dx: number;dy ​
ts
dy: number;