gameplate - v2.3.0
    Preparing search index...

    Function createGamepad

    • 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.

      Parameters

      Returns Gamepad

      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();