Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Phaser Pathfinding Help


Faces
 Share

Recommended Posts

Contrary to the name, I am finding Easystar.js to be intensely not-easy. 

I have created a tilemap in Tiled with: base, collision, and foreground layers. The collision layer consists of two tiles, a walkable (6669) and a non-walkable(540).  I have set up easystar in my create and update loop as described in the docs (see below) but constantly get either "The path to the destination point was not found", or "Your start or end point is outside the scope of your grid.".

current code: 

var level = map.layers[1].data;
 
easystar = new EasyStar.js();
easystar.setGrid(level);
easystar.setAcceptableTiles([6669]);
easystar.enableDiagonals();
easystar.enableCornerCutting();
easystar.findPath(player.x, player.y, 0, 0, function (path) {
console.log("HERE")
if (path === null) {
console.log("The path to the destination point was not found.");
} else {
for (var i = 0; i < path.length; i++) {
console.log("P: " + i + ", X: " + path.x + ",Y: " + path.y);
}
}
});

I have looked at just about every example, dissected every bit of code I can, and read every doc I can find on the subject matter but cant seem to make any headway. 

Does anyone have any experience using easystar.js or pathfinding.js? 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...