Constructor
new Path(space, points)
Create a new Path.
Parameters:
Name | Type | Description |
---|---|---|
space | Space | The space the Path is being used in |
points | Array.<Vec2> | The points (Vec2) that will make up the Path |
- Source
Methods
drawDebug(ctx)
Draw a visualization of the Path for debugging purposes. Will show each point with lines connecting them, and will show which points have been completed based on the counter.
Parameters:
Name | Type | Description |
---|---|---|
ctx | CanvasRenderingContext2D | Canvas context to draw on |
- Source
getDestination(pos)
Get the next destination in the path, based on a specified current position. Will advance the counter and return the next point if the specified position is close enough.
Parameters:
Name | Type | Description |
---|---|---|
pos | Vec2 | Position to check with |
- Source
Returns:
Next point in path
getEnd() → {Vec2}
Get the last position in the path.
- Source
Returns:
Last path position
- Type:
- Vec2