Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

Joystick

<Joystick onSteer> is the stick a thumb drags to steer. It stands in the screen’s bottom-left slot, drawn for a coarse pointer only, and clear of the corner by a thumb’s reach; slot moves it to another slot. The slots keep clear of the device’s safe area and the player app’s controls, so a game names no position. It reports where the thumb is on the unit disc: x right and y up the screen, and (0, 0) when released. A thumb that lands just outside the ring still catches it, and the ring grows to show what it caught.

Its props are in JoystickProps.

A stick that steers the player’s character passes onSteer={steerFromStick} directly, the function useInput’s steer holds: it points the stick, and the character’s movement reads it off useInput’s intent alongside the keyboard.

import { Hud, Joystick, steerFromStick } from "@spawnite/engine";
export function TouchControls() {
return (
<Hud>
<Joystick onSteer={steerFromStick} />
</Hud>
);
}