Namespace: PathFollower

Phaser.GameObjects.Components. PathFollower

Provides methods used for managing a Game Object following a Path. Should be applied as a mixin and not used directly.

Since: 3.17.0
Source: src/gameobjects/components/PathFollower.js (Line 13)

Members


path :Phaser.Curves.Path

The Path this PathFollower is following. It can only follow one Path at a time.

Type:
Since: 3.0.0
Source: src/gameobjects/components/PathFollower.js (Line 23)

rotateToPath :boolean

Should the PathFollower automatically rotate to point in the direction of the Path?

Type:
  • boolean
Since: 3.0.0
Default Value:
  • false
Source: src/gameobjects/components/PathFollower.js (Line 32)

Methods


isFollowing()

Is this PathFollower actively following a Path or not?

To be considered as isFollowing it must be currently moving on a Path, and not paused.

Since: 3.0.0
Source: src/gameobjects/components/PathFollower.js (Line 167)
Returns:

true is this PathFollower is actively following a Path, otherwise false.

Type
boolean

pathUpdate()

Internal update handler that advances this PathFollower along the path.

Called automatically by the Scene step, should not typically be called directly.

Since: 3.17.0
Source: src/gameobjects/components/PathFollower.js (Line 348)

pauseFollow()

Pauses this PathFollower. It will still continue to render, but it will remain motionless at the point on the Path at which you paused it.

Since: 3.3.0
Source: src/gameobjects/components/PathFollower.js (Line 283)
Returns:

This Game Object.

Type
Phaser.GameObjects.Components.PathFollower

resumeFollow()

Resumes a previously paused PathFollower.

If the PathFollower was not paused this has no effect.

Since: 3.3.0
Source: src/gameobjects/components/PathFollower.js (Line 304)
Returns:

This Game Object.

Type
Phaser.GameObjects.Components.PathFollower

setPath(path [, config])

Set the Path that this PathFollower should follow.

Optionally accepts Phaser.Types.GameObjects.PathFollower.PathConfig settings.

Parameters:
Name Type Argument Description
path Phaser.Curves.Path

The Path this PathFollower is following. It can only follow one Path at a time.

config number | Phaser.Types.GameObjects.PathFollower.PathConfig | Phaser.Types.Tweens.NumberTweenBuilderConfig <optional>

Settings for the PathFollower.

Since: 3.0.0
Source: src/gameobjects/components/PathFollower.js (Line 111)
Returns:

This Game Object.

Type
Phaser.GameObjects.Components.PathFollower

setRotateToPath(value [, offset])

Set whether the PathFollower should automatically rotate to point in the direction of the Path.

Parameters:
Name Type Argument Default Description
value boolean

Whether the PathFollower should automatically rotate to point in the direction of the Path.

offset number <optional>
0

Rotation offset in degrees.

Since: 3.0.0
Source: src/gameobjects/components/PathFollower.js (Line 145)
Returns:

This Game Object.

Type
Phaser.GameObjects.Components.PathFollower

startFollow( [config] [, startAt])

Starts this PathFollower following its given Path.

Parameters:
Name Type Argument Default Description
config number | Phaser.Types.GameObjects.PathFollower.PathConfig | Phaser.Types.Tweens.NumberTweenBuilderConfig <optional>
{}

The duration of the follow, or a PathFollower config object.

startAt number <optional>
0

Optional start position of the follow, between 0 and 1.

Since: 3.3.0
Source: src/gameobjects/components/PathFollower.js (Line 184)
Returns:

This Game Object.

Type
Phaser.GameObjects.Components.PathFollower

stopFollow()

Stops this PathFollower from following the path any longer.

This will invoke any 'stop' conditions that may exist on the Path, or for the follower.

Since: 3.3.0
Source: src/gameobjects/components/PathFollower.js (Line 326)
Returns:

This Game Object.

Type
Phaser.GameObjects.Components.PathFollower