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 158)
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 332)

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 267)
Returns:

This Game Object.

Type
Phaser.GameObjects.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 288)
Returns:

This Game Object.

Type
Phaser.GameObjects.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 102)
Returns:

This Game Object.

Type
Phaser.GameObjects.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 136)
Returns:

This Game Object.

Type
Phaser.GameObjects.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 175)
Returns:

This Game Object.

Type
Phaser.GameObjects.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 310)
Returns:

This Game Object.

Type
Phaser.GameObjects.PathFollower