Skip to content
Back to skills

Read Gamepad

ASecurity

Read face buttons, shoulders, sticks, and triggers from up to four controllers.

  • 17 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 7, 2026
development

Security analysis

A100/100

Scanned November 24, 2026

npx -y skills add blit386/blit386 --skill read-gamepad --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Read Gamepad?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Read Gamepad
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/blit386-read-gamepad/badge)](https://www.skillsdirectory.com/skills/blit386-read-gamepad)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: read-gamepad
description:
  Read gamepad face buttons, shoulders, analog sticks, and triggers from up to four controllers. Use for controller
  support, analog movement, or multiplayer input.
---

# Read a gamepad

Read face buttons, shoulders, sticks, and triggers from up to four controllers.

## How to do it

```js
update() {
    // Buttons use the same calls as the keyboard face buttons.
    if (BT.isDown(BT.BTN_A, 0)) this.boost();
    if (BT.isPressed(BT.BTN_START, 0)) this.pause();

    // Sticks and triggers are analog: getAxis returns -1..1 (sticks) or 0..1 (triggers).
    const x = BT.getAxis(BT.AXIS_LEFT_X, 0);
    const y = BT.getAxis(BT.AXIS_LEFT_Y, 0);
    this.player.x += Math.round(x * 3);
    this.player.y += Math.round(y * 3);

    if (!BT.isGamepadConnected(0)) this.showConnectHint();
}
```

## Any button (engine 1.8.0+)

```js
update() {
    if (BT.isAnyButtonPressed(0)) this.startGame(); // any button on player 0's pad went down
    if (BT.isAnyButtonReleased(0)) this.padIdle = true; // the LAST held button came up
}
```

`isAnyButtonPressed(player?, repeat?)` fires on every new button, even with another held. `isAnyButtonReleased` means
everything is up now, or the pad disconnected while buttons were held. These cover `BTN_UP` to `BTN_SELECT` only: no
sticks, no analog triggers, no keyboard (use `BT.isAnyKeyPressed()` for that). `player` defaults to `0`.

## Key calls

- `BT.isDown(button, player)` / `BT.isPressed(...)` / `BT.isReleased(...)` - methods. Buttons: `BTN_UP/DOWN/LEFT/RIGHT`,
  `BTN_A/B/X/Y`, `BTN_L/R` (shoulders), `BTN_L2/R2` (engine 1.8.0+: the triggers as buttons, on at 50% pull or more),
  `BTN_START`, `BTN_SELECT`; masks `BTN_ABXY`, `BTN_SHOULDER`, `BTN_TRIGGER` (either trigger, engine 1.8.0+). `BTN_L2` /
  `BTN_R2` are gamepad only: no keyboard key triggers them, `BT.inputMap` ignores them, and the 50% threshold is fixed -
  read `AXIS_TRIGGER_L/R` when you need the amount.
- `BT.isAnyButtonDown(player?)` / `BT.isAnyButtonPressed(player?, repeat?)` / `BT.isAnyButtonReleased(player?)` -
  methods, engine 1.8.0+. They cover `BTN_UP` to `BTN_SELECT` only, not the trigger buttons.
- `BT.getAxis(axis, player?)` - method. Axes: `AXIS_LEFT_X/Y`, `AXIS_RIGHT_X/Y`, `AXIS_TRIGGER_L/R`.
- `BT.isGamepadConnected(player?)` - method.
- `BT.gamepadCount` - getter; number of connected pads (0-4).
- Players: `BT.PLAYER_ONE` ... `BT.PLAYER_FOUR` (or just `0`-`3`).

## Notes

- Players 0 and 1 merge keyboard and gamepad; players 2 and 3 are gamepad-only for face buttons.
- Sticks have a dead zone, so small drift reads as 0.
- Multiply an axis by your speed and `Math.round` before moving (drawing is integer-only).

See `docs/input.md`.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.