Fourway Component

Move an entity in four directions by using the Up Arrow, Left Arrow, Down Arrow, Right Arrow keys or W, A, S, D.

This component is a thin wrapper around the Multiway component and sets the appropriate key bindings. It is a well suited for games with a top-down (birds-eye) perspective.

See Also

Methods

Back to top

.fourway()

public this .fourway([Number speed])
speed

The speed of motion in pixels per second.

Constructor to initialize the speed. Component will listen for key events and move the entity in the respective direction by the speed passed in the argument.