// initialisation // // create grid this.field = new gamvas.AStarGrid(20, 20, this.allowDiagonal, false, gamvas.AStar.STRATEGY_IGNORE_STEPS); // fill our grid with random data (< 0 means not walkable, >= 0 is a height field for (var y = 0; y < 20; y++) { for (var x = 0; x < 20; x++) { var v = parseInt(Math.random()*6, 10)-1; this.field.setValue(x, y, v); } } // find this.currentResult = this.field.find(0, this.startY, 19, this.endY);