# Class: AStarNode

## AStarNode(x, y, idx)

A single map node. All nodes are assumed traversable and have the same cost. Obstructions in the map are defined with a false value in the map data and do not have a node instance. All nodes are created by the AStarPathFinder.loadMap() method and stored in the AStarPathFinder.nodes and AStarPathFinder.nodesPosition arrays.

## Constructor

#### new AStarNode(x, y, idx)

Create a new node instance and set basic properties.
##### Parameters:
Name Type Description
`x` number The X position in the map
`y` number The Y position in the map
`idx` number Unique number / index in array
##### Properties:
Name Type Description
`idx` number The array index value (not used, but handy to have)
`x` number The X position on the map
`y` number The Y position on the map
`F` number The F value of this node (g+h)
`g` number The g Score of this node, cost of getting here from the start along the best path so far
`h` number The h Score of this node, distance to the destination in a straight line
`parent` AStarNode The node we came from on the best path so far
`isOpen` boolean Is the node Open (in the open set), candidate to be looked at
`isClosed` boolean Is the node Closed (in the closed set), finished with this node
`inPath` boolean Is this node in the final path, only set once the path is found
Version:
• 1.0
Author:
Source:

### Members

#### F

Get the F value (g + h)
Source:

### Methods

#### close()

Set the node to Closed (we are done with this node)
Source:

#### distanceTo(dest) → {number}

Get the distance to the supplied node, calculated as a straight line between the points using Pythagoras
##### Parameters:
Name Type Description
`dest` Node The destination node
Source:
##### Returns:
- Distance bewtween the two nodes
Type
number

#### open()

Set the node to Open (we may want to explore this node later)
Source: