onGamepadStick(stick: GamepadStick, action: (value: Vec2, gameepad: KGamepad)=>void): KEventController
Register an event that runs when the gamepad axis exists.
param
stick- The stick to listen for. See
param
action- The function that is run when a specific gamepad stick is moved.
// player move
let player = add([
pos(center()),
sprite(`bean`),
]);
// when left stick is moved
onGamepadStick("left", (stickVector, gp) => {
player.move(stickVector.x, 0);
});
returns
The event controller.
since
v3000.0
group
Input