KeyboardControl component for handling keyboard input events.
KeyboardControl component handles the keyboard input events for an actor. It can be used to bind keyboard events to game actions.
// Create a keyboard controlconst keyboardControl = new KeyboardControl({ inputEventBindings: [ { key: 'KeyW', pressed: true, keepEmit: true, eventType: 'RUN', attrs: [ { name: 'angle', type: 'number', value: 270, }, ], }, ],});// Add to actoractor.setComponent(keyboardControl); Copy
// Create a keyboard controlconst keyboardControl = new KeyboardControl({ inputEventBindings: [ { key: 'KeyW', pressed: true, keepEmit: true, eventType: 'RUN', attrs: [ { name: 'angle', type: 'number', value: 270, }, ], }, ],});// Add to actoractor.setComponent(keyboardControl);
Creates a new KeyboardControl component.
Configuration for the keyboard control
Optional
Input event bindings
Static
KeyboardControl component for handling keyboard input events.
KeyboardControl component handles the keyboard input events for an actor. It can be used to bind keyboard events to game actions.
Example