getDistance=function(x1,y1,x2,y2){
// Octile distance
var dx,dy;return diagonalsEnabled?(dx=Math.abs(x1-x2))<(dy=Math.abs(y1-y2))?1.4*dx+dy:1.4*dy+dx:(dx=Math.abs(x1-x2))+(dy=Math.abs(y1-y2))}
This method steps through the A* Algorithm in an attempt to
find your path(s). It will search 4-8 tiles (depending on diagonals) for every calculation.
You can change the number of calculations done in a call by using
easystar.setIteratonsPerCalculation().