Class: PathFollower

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.

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>

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>

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>

If non-zero then the follower expects to control a physics object using "arcade.moveToObject" to control velocity.

src/plugins/path/PathFollower.js line 25

phaser-ce@2.8.8 is on GitHub and NPM

Documentation generated by JSDoc 3.5.4 on 2017-09-25 using Tomorrow.