Created
January 16, 2013 04:48
-
-
Save McFunkypants/4544716 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Node function, returns a new object with Node properties | |
// Used in the calculatePath function to store route costs, etc. | |
function Node(Parent, Point) | |
{ | |
var newNode = { | |
// pointer to another Node object | |
Parent:Parent, | |
// array index of this Node in the world linear array | |
value:Point.x + (Point.y * worldWidth), | |
// the location coordinates of this Node | |
x:Point.x, | |
y:Point.y, | |
// the distanceFunction cost to get | |
// TO this Node from the START | |
f:0, | |
// the distanceFunction cost to get | |
// from this Node to the GOAL | |
g:0 | |
}; | |
return newNode; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment