Jump to content

Problem with pathfinder plugin


robersend
 Share

Recommended Posts

Hi, i'm working with the pathfinder plugin for easystar but it always returns a null path. Here's my code

var 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

 Share

  • Recently Browsing   0 members

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