MovementControllers.LinearMovementController

Description: Defines a LinearMovementController that can move objects Up, Right, Left, Down or a combination.

Extends: MovementControllers.MovementController

Constructors

LinearMovementController (movables, moveSpeed)
Creates a new instance of the LinearMovementController object which rotates the provided moveable's on movements and can move diagonally.

movables: EndGate.IMoveable[]
Array of moveable objects that will be moved when the movement controller moves (this cannot change after construction).

moveSpeed: number
How fast the movement controller will move.

LinearMovementController (movables, moveSpeed, rotateWithMovements)
Creates a new instance of the LinearMovementController object which can move diagonally.

movables: EndGate.IMoveable[]
Array of moveable objects that will be moved when the movement controller moves (this cannot change after construction).

moveSpeed: number
How fast the movement controller will move.

rotateWithMovements: boolean
Whether the movables should rotate to face their moving direction, default is true (this cannot change after construction).

LinearMovementController (movables, moveSpeed, rotateWithMovements, multiDirectional)
Creates a new instance of the LinearMovementController object..

movables: EndGate.IMoveable[]
Array of moveable objects that will be moved when the movement controller moves (this cannot change after construction).

moveSpeed: number
How fast the movement controller will move.

rotateWithMovements: boolean
Whether the movables should rotate to face their moving direction. Default is true (this cannot change after construction).

multiDirectional: boolean
Whether multiple movements can occur simultaneously, resulting in diagonal movements. Default is true (this cannot change after construction).

Fields

OnMove: EndGate.EventHandler1 <MovementControllers.IMoveEvent>
Event: Triggered when a the movement controller starts or stops a movement. Functions can be bound or unbound to this event to be executed when the event triggers. Passes an IMoveEvent to bound functions.

Inherited from: MovementControllers.MovementController

Position: EndGate.Vector2d
Gets or sets the position of the MovementController

Velocity: EndGate.Vector2d
Gets or sets the velocity of the MovementController.

Rotation: number
Gets or sets the rotation of the MovementController

Methods

IsMovingInDirection()
Determines if the movement controller is moving in the provided direction.

StartMoving()
Starts moving the movement controller in the specified direction.

StopMoving()
Stops the movement controller from moving in the specified direction.

MoveSpeed()
Gets the current move speed.

Update()
Moves the LinearMovementController in the currently active directions. MovementController's must be updated in order to move.

Move()
Triggers a move event on the MovementController.

Inherited from: MovementControllers.MovementController

Freeze()
Prevents the MovementController from updating object locations.

Thaw()
Used to re-enable movement within the MovementController.

IsMoving()
Determines if the MovementController is moving. Frozen MovementControllers are not considered moving.

Examples

There's currently no example available for this page. If you'd like to suggest one send me an containing a description, code, and link to the page for the suggested example. As a thanks I'll associate the code snippet with your name directly below the example if approved.