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


Back to top


public this .fourway([Number 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.