Contains the keyboard information in the last frame. It uses the code property of the js keyboard event.
KeyboardEvent: code property
const keyboard = this.inputManager.keyboard;if (keyboard.isPressed("ArrowRight")) { // if the right arrow key is pressed, do some action}if (keyboard.orPressed("Enter", "Space")) { // if the enter key or space key are pressed, do some action}if (keyboard.andPressed("ControlLeft", "KeyC")) { // if the left control key and the letter C key are pressed, do some action} Copy
const keyboard = this.inputManager.keyboard;if (keyboard.isPressed("ArrowRight")) { // if the right arrow key is pressed, do some action}if (keyboard.orPressed("Enter", "Space")) { // if the enter key or space key are pressed, do some action}if (keyboard.andPressed("ControlLeft", "KeyC")) { // if the left control key and the letter C key are pressed, do some action}
The current pressed key codes
Returns TRUE if all the given keys are being pressed.
The codes of the keys to check
TRUE for pressed, FALSE instead
This method accepts two parameters that will be returned depending on whether all the given keys are being pressed.
The value to return if the key is pressed
The value to return if the key is not pressed
The returnTrue for pressed or the returnFalse instead
Returns TRUE if the given key is being pressed.
The code of the key to check
TRUE true for pressed, FALSE instead
This method accepts two parameters that will be returned depending on whether the key is pressed or not.
Returns TRUE if one of the given keys is being pressed.
This method accepts two parameters that will be returned depending on whether one of the given keys is being pressed.
Contains the keyboard information in the last frame. It uses the code property of the js keyboard event.
See
KeyboardEvent: code property
Example