2
的路徑:繼我有多數民衆贊成在輸出一個libGdx路徑代碼在LibGdx
public Target(Vector2 villager, Vector2 target){
pathFinder = new IndexedAStarPathFinder<Node>(LevelManager.graph, false);
int startX = (int) villager.x;
int startY = (int) villager.y;
int endX = (int) target.x;
int endY = (int) target.y;
Node startNode = LevelManager.graph.getNodeByXY(startX, startY);
Node endNode = LevelManager.graph.getNodeByXY(endX, endY);
pathFinder.searchNodePath(startNode, endNode, new HeuristicImp(), resultPath);
Gdx.app.log("Path", ""+ resultPath.getCount());
}
我的問題是,有沒有再使用resultPath來實現,而無需使用轉向動作的運動方式?一些簡單的掌握和實施?我正在討論根據輸出路徑移動精靈的x和y。幫助將不勝感激!
resultPath在哪裏進來?當連接被添加時,你是否循環?或者你以某種方式解釋整個路徑?我不明白路徑如何轉化爲下一個位置。 – Snupas
作爲'nextPosition',你應該只保留路徑的下一個節點 - 整個路徑應該保存在另一個變量中 –
任何提示Node到Vector2翻譯發生的地方? – Snupas