Jump to content

Pathfinding in TileMap


ironicnet
 Share

Recommended Posts

Hi guys!

 

I'm testing phaser for a small game that i'm doing.

 

I noticed that there is no pathfinding implemented in phaser.

 

Which libraries are you using for this?

 

I've used "Pathfinding.js" in the past, but it requires a matrix grid. The data property in the tilemaps of phaser are stored in a single array, instead of a matrix.

So using this library requires me to keep replicating the changes in the tilemap data property into a matrix.

 

How can achieve this more easily?

 

Link to comment
Share on other sites

Why would you need to replicate?

Your pathfinding algorithm can work just as well with the array, since you still have map boundaries (width and height).

 

Just calculate the array index of a certain field x/y, then pull that value from the array to analyze it in your A* algorithm.

Link to comment
Share on other sites

Sorry I've no idea why it doesn't work on plunkr, maybe something to do with the paths to the files?

 

Documentation is coming I promise! I'm working my butt off ready for the 1.0 release on Monday, and it has docs. Hopefully will get time to do some mini getting started guides too.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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