Ir al contenido

gdmp.input

Esta página aún no está disponible en tu idioma.

Runs on: Play client.

Call What it does
onButton(cb) cb({button, down, player, at}) (player: GD’s player 1 or 2; at: when, on gdmp.time.now()’s clock) — read only: the game still gets every press. button: "jump" "left" "right" (GD’s own actions), and (level 92) "up" (W / Up) "down" (S / Down) "interact" (E) "use" (F) "slot1".."slot9" (1..9) – keys GD has no action for, read while GD’s window is in front. W and Up are also GD’s jump keys: they report "jump" and "up"

The declarations from the GDMP types (namespace GDMP), comments included:

type Button =
| 'jump' | 'left' | 'right' | 'up' | 'down' | 'interact' | 'use'
| 'slot1' | 'slot2' | 'slot3' | 'slot4' | 'slot5' | 'slot6' | 'slot7' | 'slot8' | 'slot9';
/** `player`: GD's player 1 or 2 (dual mode); `at`: when, on `gdmp.time.now()`'s clock. */
interface ButtonEvent { readonly button: Button; readonly down: boolean; readonly player: number; readonly at: number }
interface Input {
/** Read only: the game still gets every press. */
onButton(cb: Callback<[event: ButtonEvent]>): void;
}