new PathFollower(path, follower [, speed] [, angleOffset] [, callbackAtEnd] [, physicsAdjustTime])
A PathFollower is a virtual entity that follows the Path. It is usually linked to a game object such as a Sprite and it will control either the position of that object, or its velocity if it is a physics object.
Callbacks will be triggered when certain events happen as the follower moves. These may be used to aid in the creation of complex behaviours for the game objects.
Parameters:
Name | Type | Argument | Default | Description |
---|---|---|---|---|
path |
Phaser.Path | The Path object which this follower is created on. |
||
follower |
Phaser.Sprite | object | The game object which this follower controls. Requires public properties: |
||
speed |
number |
<optional> |
1 | The current speed of this follower in pixels per frame. This value is multiplied with the Path segment speed to give the final value used. |
angleOffset |
number |
<optional> |
null | If |
callbackAtEnd |
function |
<optional> |
A callback to be invoked when the follower reaches the end of a path. |
|
physicsAdjustTime |
number |
<optional> |
0 | If non-zero then the follower expects to control a physics object using "arcade.moveToObject" to control velocity. |