Kaplay.Patrol
Modules
Comp
Types
endBehavior
type endBehavior = | @as("loop") Loop | @as("ping-pong") PingPong | @as("stop") Stop
patrolCompOptions
type patrolCompOptions = { waypoints?: array<Kaplay.Vec2.t>, speed?: float, endBehavior?: endBehavior,}
Fields
waypoints option < array >
speed option < float >
endBehavior option < endBehavior >
Values
addPatrolComponent
Requires a Pos
component.
let addPatrol: (Kaplay.Context.t, patrolCompOptions) => Kaplay.Types.comp
Return type
getNextLocation
let getNextLocation: T.t => option<Kaplay.Vec2.t>
Parameters
T.t
Return type
option < Kaplay.Vec2.t >
getPatrolSpeed
let getPatrolSpeed: T.t => float
Parameters
T.t
Return type
float
getWaypoints
let getWaypoints: T.t => option<array<Kaplay.Vec2.t>>
Parameters
T.t
Return type
option < array >
onPatrolFinished
onPatrolFinished(context, (t) => unit)
Attaches an event handler which is called when using "stop" and the end of the path is reached.
let onPatrolFinished: (T.t, T.t => unit) => unit
Parameters
T.t
T.t
unit
Return type
unit
onPatrolFinishedWithController
onPatrolFinished(context, (t) => unit)
Attaches an event handler which is called when using "stop" and the end of the path is reached.
let onPatrolFinishedWithController: (T.t, T.t => unit) => Kaplay.KEventController.t
Parameters
T.t
T.t
unit
Return type
setNextLocation
let setNextLocation: (T.t, Kaplay.Vec2.t) => unit
Return type
unit
setPatrolSpeed
let setPatrolSpeed: (T.t, float) => unit
Parameters
T.t
float
Return type
unit
setWaypoints
let setWaypoints: (T.t, array<Kaplay.Vec2.t>) => unit
Return type
unit