Jump to content

Easystar pathfinding path always empty


Recommended Posts

Hey, I'm messing around with pathfinding. Modified the Easystar Phaser plugin for ES6, but it seems to always return an empty path: https://max-arias.github.io/miner-idle-1click/

(source is 0,0)


Calculation is here: https://github.com/max-arias/miner-idle-1click/blob/master/src/entities/Map.js


let walkableTiles = [2, 150, 152, 166, 35, 68, 18]
    this.pathfinder = this.game.plugins.add(PathFinderPlugin);
    this.pathfinder.setGrid(this.layers[1].data, walkableTiles);

  update () {}

  findPathTo(fromX, fromY, toX, toY) {

    this.pathfinder.setCallbackFunction((path) => {
      path = path || [];
      console.log(`path: ${path}`);
      // for(var i = 0, ilen = path.length; i < ilen; i++) {
      //   map.putTile(46, path[i].x, path[i].y);
      // }


    this.pathfinder.preparePathCalculation([0, 0], [toX, toY]);

Grid data looks good... ideas?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

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