Move To behavior script interface

The IMoveToBehaviorInstance interface derives from IBehaviorInstance to add APIs specific to the Move To behavior.

Move To behavior events

"arrived"
Fired when the object arrives at its destination.
"hitsolid"
If Stop on solids is enabled, fired when the object hits a solid and stops.

Move To behavior APIs

moveToPosition(x, y, isDirect = true)
Start moving the object to a target position in layout co-ordinates. If isDirect is true, any existing waypoints will be cleared so the object moves directly to this position; otherwise it will add a waypoint to the queue.
getTargetX()
getTargetY()
getTargetPosition()
Return the current target position in layout co-ordinates that the object is moving to. The getTargetPosition() variant returns [x, y].
getWaypointCount()
Return the number of waypoints that have been added.
getWaypointX(index)
getWaypointY(index)
getWaypoint(index)
Return the position in layout co-ordinates of a waypoint at a given zero-based index. The getWaypoint() variant returns [x, y].
stop()
Stop any current movement, and clear all waypoints.
isMoving
Read-only boolean indicating whether the object is currently moving.
speed
Set or get the current movement speed in pixels per second.
maxSpeed
Set or get the maximum movement speed in pixels per second.
acceleration
deceleration
Set or get the acceleration and deceleration of the movement in pixels per second per second.
angleOfMotion
Set or get the current angle the object is moving at, in radians.
rotateSpeed
Set or get the rate the object can turn at, in radians per second.
isStopOnSolids
Set or get a boolean indicating whether the Stop on solids property is enabled. When enabled the object will stop its movement, clear all waypoints and fire the "hitsolid" event if it touches an object with the Solid behavior during movement.
isEnabled
A boolean indicating if the behavior is enabled. If disabled, the behavior no longer has any effect on the object.
Construct 3 Manual 2020-09-29