How do I "unstick" stuck pathfinding objects?

0 favourites
  • 2 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hi, I've got a strange problem and I'm not sure what holes in my logic are causing it. Basically, my enemies are set to pathfind to the player when they are in range, stopping and setting a new path every second or so or when they stop. However, if an enemy cannot find a path when that time arrives, it does not try again when the timer expires, instead this happens:

    and it stays this way. After this, they stand still permanently. They still detect the player and the relevant "chase the player" variables still function, but the pathfinding itself does not.

    I have a hunch this is happening because the enemies are solid or obstacles of each others' (so that they don't overlap), because it works just fine with I disable those behaviors. Thus, they try to path around each other to the player but cannot because other enemies are in the way, so they stop and then for some reason don't start again. Here is a big ol' image with all of the code for the enemy:

    Any ideas as to why it's happening and/or how I can force them to recalculate? I thought I was already doing that with line 163 but perhaps not.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Quick double post to say that if there is another method of making them not overlap that doesn't involve the solid behavior, which would sidestep this problem, I will take that as an answer too!

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