## Constructors

- [Animation](/content/docs/Animation/index.html)
- [IsoCharacter](/content/docs/IsoCharacter/index.html)
- [Path](/content/docs/Path/index.html)
- [PhysicsObject](/content/docs/PhysicsObject/index.html)
- [SceneObject](/content/docs/SceneObject/index.html)
- [SceneObjectGroup](/content/docs/SceneObjectGroup/index.html)
- [Sprite](/content/docs/Sprite/index.html)
- [TextSprite](/content/docs/TextSprite/index.html)
- [TilemapCharacter](/content/docs/TilemapCharacter/index.html)
- [wade](/content/docs/wade/index.html)
- [wade.drawFunctions](/content/docs/wade.drawFunctions)
- [wade.iso](/content/docs/wade.iso)
- [wade.physics](/content/docs/wade.physics)
- [wade.tilemap](/content/docs/wade.tilemap)
- [wade.vec2](/content/docs/wade.vec2)

## Path

# Constructor Summary

**Path**  
A Path is a collection of nodes that a scene object can be told to follow.

# Functions Summary

**Path.addNode** _(node)_  
Add a node to the path.

**Path.clone** _()_  
Create a clone of the path

**Path.debugDraw** _(toggle, layerId)_  
Create sprites to provide a visual representation of the path

**Path.evaluate** _(sceneObject, time)_  
Evaluate the properties of the path at the specified time, and apply them to a SceneObject.

**Path.getName** _()_  
Get the name of the path

**Path.getNode** _(nodeIndex)_  
Get the data for a node in the path. Note that this is a copy of the data, if you want to access the node object that is in the path directly, please use _getNodeRef_.

**Path.getNodeCount** _()_  
Get the current number of nodes in the path

**Path.getNodeRef** _(nodeIndex)_  
Get the data for a node in the path. Note that this is NOT a copy of the data, but a reference to it.

**Path.getNodes** _()_  
Get a copy of the nodes array

**Path.isInScene** _()_  
Check whether the path is currently in the scene

**Path.removeNode** _(nodeIndex)_  
Remove a node from the array of nodes

**Path.serialize** _(stringify)_  
Create an object representation of the path. This can be used to construct a new path, passing it directly into the Path constructor.

**Path.setFromSceneObject** _(sceneObject, nodeIndex)_  
Set the properties of a node based on the current values present in a SceneObject. This function looks at the properties that are defined on the next node to determine which properties should be affected in the current node.

**Path.setName** _(name)_  
Set a name for this path

**Path.setNode** _(nodeIndex, nodeData)_  
Set a node in the path

**Path.setNodes** _(nodes)_  
Set an array of nodes that this path will use. See _setNode_ for a definition of the data structure to use for each node.

# Constructor Details

**Path**  
A Path is a collection of nodes that a scene object can be told to follow.

Any values between nodes (not just position but opacity, size, rotation and any custom properties) are interpolated using a method that you can change per node.

When a SceneObject is on a Path segment, any properties that are present on both the start and end node of that segment are interpolated and applied to the object and all of its sprites.

Array|object  nodes  (optional): An array of nodes (see _setNode_ for a definition of the data structure of each node). You can also use this constructor by passing in a single object (so just the first parameter) that contains all the Path properties that you want to set (see remarks below for more details).

string  name  (optional): The name of the path. This can be used to refer to the path using _wade.getPath(pathName)_.

**Remarks:**

You can also use this constructor by passing in a single object (so just the first parameter) that contains all the Path properties that you want to set. In this case, the object structure is as follows (all fields are optional):

```
{
    type: 'Path',
    nodes: Array,
    name: string
}
```

# Function Details

**Path.addNode** _(node)_  
Add a node to the path.

object  node : A node data structure. See the documentation of _setNode_ for more details.

Returns Number : The index of the node in the nodes array

**Path.clone** _()_  
Create a clone of the path

Returns Path : A new Path object

**Path.debugDraw** _(toggle, layerId)_  
Create sprites to provide a visual representation of the path

boolean  toggle  (optional): Whether to enable or disable debug drawing. If omitted, this parameter is assumed to be true.

number  layerId  (optional): The layer that the sprites will use. By default this is 1.

Returns SceneObject : A SceneObject that contains all the sprites needed for the debug draw.

**Path.evaluate** _(sceneObject, time)_  
Evaluate the properties of the path at the specified time, and apply them to a SceneObject.

SceneObject  sceneObject : The SceneObject to apply the properties to

number  time : The path time

Returns number : The index of the node that marks the start of the segment for the specified time

**Path.getName** _()_  
Get the name of the path

Returns : {string}

number  nodeIndex  (optional): The index of the node. If omitted, the first node will be returned.

Returns Object : A copy of the node data

**Path.getNodeCount** _()_  
Get the current number of nodes in the path

Returns Number : The number of nodes in the path

**Path.getNodeRef** _(nodeIndex)_  
Get the data for a node in the path. Note that this is NOT a copy of the data, but a reference to it.

number  nodeIndex  (optional): The index of the node. If omitted, the first node will be returned.

Returns Object : The node data

**Path.getNodes** _()_  
Get a copy of the nodes array

Returns Array : A copy of the nodes array

**Path.isInScene** _()_  
Check whether the path is currently in the scene

Returns boolean : Whether the path is currently in the scene

**Path.removeNode** _(nodeIndex)_  
Remove a node from the array of nodes

number  [nodeIndex : = 0] The index of the node to remove

boolean  stringify : Whether a string representation of the object should be returned, rather than the object itself

Returns object : An object representation of the path.

SceneObject  sceneObject : The SceneObject to use

number  [nodeIndex : = 0] The index of the node that you want to modify

**Path.setName** _(name)_  
Set a name for this path

string  name : The name to set

**Path.setNode** _(nodeIndex, nodeData)_  
Set a node in the path

number  nodeIndex : The index of the node to change

object  nodeData : The data to set for the node. This is an object that can contain any of the following fields (all optional):

{
    tweenType: string - it can be 'linear', 'quadratic', 'cubic', 'quartic', 'quintic', 'sinusoidal', 'exponential', 'circular'
    position: {x: number, y: number},
    size: {x: number, y: number},
    opacity: number,
    rotation: number,
    properties: {}
}

Where _properties_ is an object that can contain any number of custom fields.

**Path.setNodes** _(nodes)_  
Set an array of nodes that this path will use. See _setNode_ for a definition of the data structure to use for each node.
