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. |
Members
-
<static, constant> DATA_COUNTER : number
-
Type:
- number
-
<static, constant> DATA_NONE : number
-
Type:
- number
-
<static, constant> DATA_PAUSE : number
-
Type:
- number
-
<static, constant> DATA_VALUE : number
-
Type:
- number
-
active : boolean
-
Is this point a selected (or active) point?
Type:
- boolean
-
branchPath : Phaser.Path
-
A branched path which is attached at this point.
Type:
-
branchPointIndex : number
-
The index where the branch is attached to on the new path.
Type:
- number
-
branchType : number
-
The branch type of the path this point is on. Either 0 (attached) or 1 (joined)
Type:
- number
-
controlPoints : array
-
A list of Phaser.Point objects representing the control points on the segment.
Type:
- array
-
<protected> curve : number
-
Once the Hermite curve is calculated, store it to avoid recalculation later.
Type:
- number
-
data : object
-
Data associated with this point eg: { type: PathPoint.DATA_VALUE, value: XXX }
Type:
- object
-
speed : number
-
The speed multiplier for PathFollowers on this path segment.
Type:
- number
-
vx : number
-
The x coordinate of the tangent vector to create the curve from.
Type:
- number
-
vy : number
-
The y coordinate of the tangent vector to create the curve from.
Type:
- number
-
x : number
-
The x coordinate of the PathPoint.
Type:
- number
-
y : number
-
The y coordinate of the PathPoint.
Type:
- number
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.
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.
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 samex
,y
andspeed
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.
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.
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.
Returns:
This object.
- Type
- Phaser.PathPoint
-
toJSON()
-
Serializes this PathPoint into a JSON object and returns it.
Returns:
A JSON object representing this PathPoint.
- Type
- Object