Navigation
These archived docs are for Phaser 2.6.2 Phaser 3 docs can be found on newdocs.phaser.io.
Phaser CE docs can be found on the Phaser CE Documentation site.

Constructor

Phaser. PathFollower

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: x, y for position and rotation for angle control (if specified).

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 null then the PathFollower won't rotate. Otherwise it will face in the paths direction plus this offset which is given in radians.

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.

Source code: plugins/path/PathFollower.js (Line 25)