Pathfinding issue.

0 favourites
  • 3 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • My pathfinding is working correctly at first but after a few moves, it stops working. I have 4 sprites pathfinding their way around a little maze (a tilemap). Two of them never move and the other two move a few times and then stop forever.

    Checking in the debugger, of the two that have moved, one has 'Has Path' set to true, but isn't moving anyway. All of the others don't have a path. I'm not changing the tilemap at all, so it's not a case of obstacles changing. There are no other objects that might be blocking the paths and they have custom obstacles set (just the tilemap maze). They're moving with 'Move To' once the path is found, so that they move PacMan style (i.e along the grid).

    They're all the same sprite with the same settings (i.e the cell size is set to 20 for all of them and the tilemap is 32x32 blocks). They're not blocking each other since they're not set as obstacles.

    What else could be causing them not to move?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Share your project so we can find what is going wrong.

  • Thanks, it was an error(s) on my part I think. Basically I ripped it up and tried again and it's fine now, so at least I was understanding the pathfinding correctly. Must've made one or more mistakes elsewhere.

    Just in case it's of some use to anybody (not very likely because this was very vague), I had two mazes and I was trying to get the sprites to work out which maze they were traversing by first of all checking which maze they were overlapping. But I 'think' that C3 doesn't count overlapping as being inside the coordinates of the object, rather than actually colliding with it. And since the 'empty' squares of the maze had collisions off and the sprites were standing on empty squares, I don't think it registers as overlapping.

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