Class: PathPoint

Phaser. PathPoint

new PathPoint(x, y, vx, vy [, speed] [, data] [, branchPath] [, branchPointIndex])

The PathPoint class contains data and functions for each point on a Path.

Parameters:
Name Type Argument Default Description
x number

The x coordinate of the PathPoint.

y number

The y coordinate of the PathPoint.

vx number

The x coordinate of the tangent vector to create the curve from.

vy number

The y coordinate of the tangent vector to create the curve from.

speed number <optional>
1

The speed multiplier for PathFollowers on this Path segment.

data object <optional>

The data associated with this point, e.g.: { type: PathPoint.DATA_VALUE, value: XXX }

branchPath Phaser.Path <optional>

A branched path which is attached to this point.

branchPointIndex number <optional>

The index where the branch is attached to on the new path.

Source:
src/plugins/path/PathPoint.js line 22

Members

<static, constant> DATA_COUNTER : number

Type:
  • number
Source:
src/plugins/path/PathPoint.js line 119

<static, constant> DATA_NONE : number

Type:
  • number
Source:
src/plugins/path/PathPoint.js line 101

<static, constant> DATA_PAUSE : number

Type:
  • number
Source:
src/plugins/path/PathPoint.js line 107

<static, constant> DATA_VALUE : number

Type:
  • number
Source:
src/plugins/path/PathPoint.js line 113

active : boolean

Is this point a selected (or active) point?

Type:
  • boolean
Source:
src/plugins/path/PathPoint.js line 85

branchPath : Phaser.Path

A branched path which is attached at this point.

Type:
Source:
src/plugins/path/PathPoint.js line 63

branchPointIndex : number

The index where the branch is attached to on the new path.

Type:
  • number
Source:
src/plugins/path/PathPoint.js line 68

branchType : number

The branch type of the path this point is on. Either 0 (attached) or 1 (joined)

Type:
  • number
Source:
src/plugins/path/PathPoint.js line 73

controlPoints : array

A list of Phaser.Point objects representing the control points on the segment.

Type:
  • array
Source:
src/plugins/path/PathPoint.js line 91

<protected> curve : number

Once the Hermite curve is calculated, store it to avoid recalculation later.

Type:
  • number
Source:
src/plugins/path/PathPoint.js line 79

data : object

Data associated with this point eg: { type: PathPoint.DATA_VALUE, value: XXX }

Type:
  • object
Source:
src/plugins/path/PathPoint.js line 58

speed : number

The speed multiplier for PathFollowers on this path segment.

Type:
  • number
Source:
src/plugins/path/PathPoint.js line 53

vx : number

The x coordinate of the tangent vector to create the curve from.

Type:
  • number
Source:
src/plugins/path/PathPoint.js line 43

vy : number

The y coordinate of the tangent vector to create the curve from.

Type:
  • number
Source:
src/plugins/path/PathPoint.js line 48

x : number

The x coordinate of the PathPoint.

Type:
  • number
Source:
src/plugins/path/PathPoint.js line 33

y : number

The y coordinate of the PathPoint.

Type:
  • number
Source:
src/plugins/path/PathPoint.js line 38

Methods

clone( [out])

Creates a clone of this PathPoint object.

Parameters:
Name Type Argument Description
out Phaser.PathPoint <optional>

An optional PathPoint object into which this object is cloned. If no object is provided a new PathPoint is created.

Source:
src/plugins/path/PathPoint.js line 177
Returns:

A clone of this PathPoint.

Type
Phaser.PathPoint

copy(source)

Copies all of the values from the given PathPoint object into this PathPoint. The source PathPoint is untouched by this operation.

Parameters:
Name Type Description
source Phaser.PathPoint

The PathPoint object to copy the values from.

Source:
src/plugins/path/PathPoint.js line 193
Returns:

This PathPoint object.

Type
Phaser.PathPoint

equals(pathPoint [, offsetX] [, offsetY])

Compare this PathPoint with another PathPoint object and return true if they have the same x, y and speed properties, after taking the optional offset values into consideration.

Parameters:
Name Type Argument Default Description
pathPoint Phaser.PathPoint

The PathPoint to compare against this PathPoint.

offsetX number <optional>
0

A value to apply to the x coordinate before comparison.

offsetY number <optional>
0

A value to apply to the y coordinate before comparison.

Source:
src/plugins/path/PathPoint.js line 219
Returns:

True if the two PathPoint objects match, after the offsets are applied, or false if they don't.

Type
boolean

setTangent(vx, vy)

Sets the tangent vector properties of this PathPoint.

Parameters:
Name Type Description
vx number

The x coordinate of the tangent vector to create the curve from.

vy number

The y coordinate of the tangent vector to create the curve from.

Source:
src/plugins/path/PathPoint.js line 156
Returns:

This object.

Type
Phaser.PathPoint

setTo(x, y [, vx] [, vy])

Sets the x, y and optionally vx and vy properties of this PathPoint.

Parameters:
Name Type Argument Description
x number

The x coordinate of the PathPoint.

y number

The y coordinate of the PathPoint.

vx number <optional>

The x coordinate of the tangent vector to create the curve from.

vy number <optional>

The y coordinate of the tangent vector to create the curve from.

Source:
src/plugins/path/PathPoint.js line 123
Returns:

This object.

Type
Phaser.PathPoint

toJSON()

Serializes this PathPoint into a JSON object and returns it.

Source:
src/plugins/path/PathPoint.js line 242
Returns:

A JSON object representing this PathPoint.

Type
Object

phaser-ce@2.20.1 is on GitHub and NPM

Documentation generated by JSDoc 3.6.11 on 2024-10-05 using Tomorrow.