Faces

Members
  • Content count

    2
  • Joined

  • Last visited

  1. Phaser Pathfinding Help

    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?
  2. Im currently in the process of developing a top down tower defense shooter. My question is how would you guys go about having a player click a something (seems a button would be prudent) which would select the appropriate tower (a sprite) and maybe on mousePointer.isDown place the sprite at that location. I am not new to programming, but a bit new to phaser. After a thorough read of the docs and examples provided online, this is the area I am struggling to figure out. Once the sprite is in game its gg. But allowing the player to place it is the issue I am having. Thanks in advance!