跳转到内容

defineInputMap

此内容尚不支持你的语言。

defineInputMap(actions): InputMap

Defined in: inputMap.ts:291

Define a named-action input map and register its per-frame evaluation system. Returns the live map — import it and query by name from any system.

Record<string, ActionDef>

InputMap

export const Game = defineInputMap({
Move: Axis2D(Keys2D('KeyW','KeyS','KeyA','KeyD'), Stick('left')),
Jump: Button(Key('Space'), GpButton(GamepadButton.South)),
});
// in a system: if (Game.pressed('Jump')) ...; const dir = Game.axis2d('Move');