How do I implement point and click tiled pathfinding?

0 favourites
  • 7 posts
From the Asset Store
Connect the dots in the correct order and draw happy animals!
  • I'm trying to implement point and click tiled (ortho only, no diagonal) pathfinding like Advance Wars. The built in solution using pathfinding behavior, even when limited to 4 directions and set to not rotate, seems to have some weird easing behavior and doesn't move exactly to the point clicked. I suspect this is caused by the auto generated collision box on my sprites, but I can't seem to delete the collision box completely, all I can do is make a pretty tiny triangle with 3 nodes.

    Is there workflow for this type of pathfinding?


  • If you're making a tiled game, you should probably use tiled movement to move. You can use the pathfinding behaviour to generate the path, but use tiled movement to do the actual moving.

  • Found an old example I had made before and updated it a bit.

  • oosyrag thank you so much, your example is a perfect solution to what I was trying to do

    It should be an official behavior/plugin

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It looks like the main property that makes this work, where it didn't work in my tests, is setting Cell border on the pathfinding behavior to -1. It never occurred to me it could be lower than 0. 0 doesn't work, -1 does, and this is where my problem originally came from. Might be worth adding a note about this to the pathfinding page to clear up how cell border can be negative to make it work with 'exact sizes' such as tile grids.

  • Oh interesting I actually didn't notice that. -1 was the default. Looks like at 0 border size, they include the neighboring cells because they are touching, and therefore colliding. It works all the way to -32, and at -33 the single tile obstacles are no longer counted.

    A way to generate and visualize an obstacle map in the editor could be a nice feature to add...

  • That's a very nice way to put things up !

    Do you have an idea on how to count tiles traveled upon ?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)