Phaser API Documentation

  Version: 
Filter
This is a beta release of our new docs system. Found an issue?
Please tell us about it in the #📖-newdocs-feedback channel on the Phaser Discord
Namespace: PathFollower
Phaser.GameObjects.Components.PathFollower

Members

Description:

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

Type:
Since: 3.0.0
Focus
Focus
rotateToPath: boolean
Focus
Focus

Description:

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

Type:
boolean
Default: false
Since: 3.0.0
Focus
Focus

Methods

setPath(path, [config])
Focus
Focus

Description:

Set the Path that this PathFollower should follow.

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

Parameters:

name type arguments 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.

Returns:
Description:

This Game Object.

Examples:
Since: 3.0.0
Focus
Focus
setRotateToPath(value, [offset])
Focus
Focus

Description:

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

Parameters:

name type arguments description
value boolean

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

offset number <optional>

Rotation offset in degrees.

Returns:
Description:

This Game Object.

Examples:
Since: 3.0.0
Focus
Focus
isFollowing()
Focus
Focus

Description:

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.

Returns:
Description:

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

Type:
  • boolean
Examples:
Since: 3.0.0
Focus
Focus
startFollow([config], [startAt])
Focus
Focus

Description:

Starts this PathFollower following its given Path.

Parameters:

name type arguments 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.

Returns:
Description:

This Game Object.

Examples:
Since: 3.3.0
Focus
Focus
pauseFollow()
Focus
Focus

Description:

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.

Returns:
Description:

This Game Object.

Examples:
Since: 3.3.0
Focus
Focus
resumeFollow()
Focus
Focus

Description:

Resumes a previously paused PathFollower.

If the PathFollower was not paused this has no effect.

Returns:
Description:

This Game Object.

Examples:
Since: 3.3.0
Focus
Focus
stopFollow()
Focus
Focus

Description:

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.

Returns:
Description:

This Game Object.

Examples:
Since: 3.3.0
Focus
Focus
pathUpdate()
Focus
Focus

Description:

Internal update handler that advances this PathFollower along the path.

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

Examples:
Since: 3.17.0
Focus
Focus