Sign in to follow this  

Phaser Pathfinding Help

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.findPath(player.x, player.y, 0, 0, function (path) {
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? 

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.