robersend Posted January 6, 2016 Share Posted January 6, 2016 Hi, i'm working with the pathfinder plugin for easystar but it always returns a null path. Here's my codevar pathfinder; create: function() { var walkables = [91,27, 987, 47, 26, 90, 24, 71,25,46,93,92]; game.stage.backgroundColor = '#7878782'; map = game.add.tilemap('map'); map.addTilesetImage('mapa', 'mapa2'); map.addTilesetImage('agua', 'agua2'); map.addTilesetImage('barcos', 'barcos2'); map.addTilesetImage('muelle', 'muelle2'); map.addTilesetImage('tilee2', 'tilesvarios'); map.addTilesetImage('vx-buildingstileset', 'tilesvarios2'); pathfinder = game.plugins.add(Phaser.Plugin.PathFinderPlugin); pathfinder.setGrid(map.layers[0].data, walkables); }function findPathTo(enemyX, enemyY,tilex, tiley) { pathfinder.setCallbackFunction(function(path) { console.log(path); path = path || []; blocked = false; }); pathfinder.preparePathCalculation([enemyX,enemyY], [tilex,tiley]); pathfinder.calculatePath();} blocked = true; findPathTo(parseInt(enemy.y/TILESIZE), parseInt(enemy.x/TILESIZE) , parseInt(player.y/TILESIZE), parseInt(player.x/TILESIZE));I can't see why it fails Link to comment Share on other sites More sharing options...
robersend Posted January 6, 2016 Author Share Posted January 6, 2016 Solved Link to comment Share on other sites More sharing options...
Recommended Posts