新增a*寻路
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user