Input
Button constants
buttonDown() and buttonPressed() can also be called with no parameters to query whether any tracked logical button is currently held/pressed.
Games always use logical BTN_* constants. Keyboard and standard game controllers both drive these buttons (any attached pad is combined with the keyboard). Default bindings are listed below.
Remapping controls
Open the in-game pause menu (Escape on keyboard or Start on a gamepad), choose CONTROLS, then pick KEYBOARD or CONTROLLER to remap each logical button. Bindings are saved in your browser and apply to every PIXELFALLS game you play on that device. Use RESET DEFAULTS to restore the stock layout.
D-pad directions can be remapped on a gamepad; the left stick still moves as an alternate. Pause menu keys (Escape, Start, Enter) are not remappable.
Controller names follow the Xbox layout used by SDL. PlayStation, Switch, and similar pads still work — the letter printed on the plastic may differ.
| Constant | Role | Default key | Gamepad |
|---|---|---|---|
BTN_UP | D-pad up | Arrow Up | D-pad Up or left stick up |
BTN_DOWN | D-pad down | Arrow Down | D-pad Down or left stick down |
BTN_LEFT | D-pad left | Arrow Left | D-pad Left or left stick left |
BTN_RIGHT | D-pad right | Arrow Right | D-pad Right or left stick right |
BTN_A | Face button A | Z | A (south) |
BTN_B | Face button B | X | B (east) |
BTN_C | Face button C | A | X (west) |
BTN_D | Face button D | S | Y (north) |
BTN_L | Shoulder L | Q | Left shoulder |
BTN_R | Shoulder R | W | Right shoulder |
Escape / pause is handled by the engine menu and is not a game BTN_* constant. On a gamepad, Start toggles the pause menu. While the menu is open, D-pad or left stick Up/Down move the selection and A confirms (same as Enter). Analog triggers, the right stick, and the Guide/home button are ignored.
buttonDown
Return true while a button is held. Call it with no arguments to test any button, or pass a BTN_* constant such as BTN_RIGHT to test one button.
- buttonDown() -> bool
- buttonDown(button) -> bool
Parameters
- button — Logical button to test (use BTN_* constants; keyboard or gamepad).
Returns
- bool
Examples
-- True while any button is held.
local anyHeld = buttonDown()
-- True while Right is held.
local movingRight = buttonDown(BTN_RIGHT)buttonPressed
Return true only on the frame a button goes down. Call it with no arguments to test any button, or pass a BTN_* constant such as BTN_A to test one button.
- buttonPressed() -> bool
- buttonPressed(button) -> bool
Parameters
- button — Logical button to test (use BTN_* constants; keyboard or gamepad).
Returns
- bool
Examples
-- True on the frame any button goes down.
local anyPressed = buttonPressed()
-- True on the frame A goes down.
local jumpPressed = buttonPressed(BTN_A)