Used to bind keys to directions and have the entity move accordingly
public this .multiway([Number speed,] Object keyBindings )
Constructor to initialize the speed and keyBindings. Component will listen to key events and move the entity appropriately.
When direction changes a NewDirection event is triggered with an object detailing the new direction: {x: x_movement, y: y_movement} When entity has moved on either x- or y-axis a Moved event is triggered with an object specifying the old position {x: old_x, y: old_y}
this.multiway(3, {UP_ARROW: -90, DOWN_ARROW: 90, RIGHT_ARROW: 0, LEFT_ARROW: 180});
this.multiway({x:3,y:1.5}, {UP_ARROW: -90, DOWN_ARROW: 90, RIGHT_ARROW: 0, LEFT_ARROW: 180});
this.multiway({W: -90, S: 90, D: 0, A: 180});
public this .enableControl()
Enable the component to listen to key events.
this.enableControl();
public this .disableControl()
Disable the component to listen to key events.
this.disableControl();