Create a Gamepad reader. Pass the result through createGame (it's installed at game.gamepad and polled for you), or call poll() yourself once per frame.
createGame
game.gamepad
poll()
const game = createGame({ state: { x: 0 }, actions, update: (s, dt, actions) => { const { x, y } = game.gamepad.stick('left'); actions.moveBy(x * 200 * dt, y * 200 * dt); if (game.gamepad.wasPressed('A')) actions.jump(); },});game.start(); Copy
const game = createGame({ state: { x: 0 }, actions, update: (s, dt, actions) => { const { x, y } = game.gamepad.stick('left'); actions.moveBy(x * 200 * dt, y * 200 * dt); if (game.gamepad.wasPressed('A')) actions.jump(); },});game.start();
Create a Gamepad reader. Pass the result through
createGame(it's installed atgame.gamepadand polled for you), or callpoll()yourself once per frame.