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 118

<static, constant> DATA_NONE : number

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

<static, constant> DATA_PAUSE : number

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

<static, constant> DATA_VALUE : number

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

active : boolean

Is this point a selected (or active) point?

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

branchPath : Phaser.Path

A branched path which is attached at this point.

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

branchPointIndex : number

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

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

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 72

controlPoints : array

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

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

<protected> curve : number

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

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

data : object

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

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

speed : number

The speed multiplier for PathFollowers on this path segment.

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

vx : number

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

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

vy : number

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

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

x : number

The x coordinate of the PathPoint.

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

y : number

The y coordinate of the PathPoint.

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

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 174
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 189
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 214
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 154
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 122
Returns:

This object.

Type
Phaser.PathPoint

toJSON()

Serializes this PathPoint into a JSON object and returns it.

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

A JSON object representing this PathPoint.

Type
Object

phaser-ce@2.9.2 is on GitHub and NPM

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