KeyBindingValue
KeyBindingValue
is a union type that represents the keys associated with a particular KeyBindingType
.
type KeyBindingValue = WebKeyboardKey[] | WebKeyboardKey | null;
WebKeyboardKey
is an alias ofstring
(case-insensitive). See the MDN key values (opens in a new tab) list for valid values.null
indicates no binding (the action will be disabled until a key is assigned).
Examples
Single key
game.keyMap.setKeyBinding(KeyBindingType.skipAction, " "); // Space key
Multiple keys
game.keyMap.setKeyBinding(KeyBindingType.skipAction, ["Control", "F3"]);
Remove binding
game.keyMap.setKeyBinding(KeyBindingType.skipAction, null);
See also: KeyBindingType, KeyMap.