新增a*寻路

This commit is contained in:
yhh
2020-06-09 19:45:09 +08:00
parent 9e0d14da7c
commit 0fd33be5f9
14 changed files with 998 additions and 3 deletions

View File

@@ -3,5 +3,18 @@ class MainScene extends Scene {
super(displayContent);
this.addEntityProcessor(new SpawnerSystem(new Matcher()));
this.astarTest();
}
public astarTest(){
let graph = new AstarGridGraph(20, 20);
graph.weightedNodes.push(new Point(3, 3));
graph.weightedNodes.push(new Point(3, 4));
graph.weightedNodes.push(new Point(4, 3));
graph.weightedNodes.push(new Point(4, 4));
let path = graph.search(new Point(3, 4), new Point(15, 17));
console.log(path);
}
}