new Node(x, y)
A node for use in the Grid class.
Parameters:
| Name | Type | Description |
|---|---|---|
x |
Number | the x position of the node in the grid |
y |
Number | the y position of the node in the grid |
Properties:
| Name | Type | Description |
|---|---|---|
x |
Number | x coordinate on grid of node |
y |
Number | y coordinate on grid of node |
f |
Number | used for A* |
g |
Number | used for A* |
h |
Number | used for A* |
nodeParent |
Number | used for pathfinding |
Methods
constructor(x, y)
Creates the node
Parameters:
| Name | Type | Description |
|---|---|---|
x |
Number | the x position of the node in the grid |
y |
Number | the y position of the node in the grid |
isClosed()
Checks if a node isn't walkable
Returns:
true if node is not walkable
isOpen()
Checks if a node is open for traversing
Returns:
true if node has null value and is walkable