How do I Pathfind within distance.

  • Hi guys. I am working on a top down shooter game. As a hobby mostly. I Am trying to program basic enemy ai and having a few problems. I searched the forums but cant seem to find exactly what I am looking for.

    What I would like to do:

    -When my character gets with a certain distance from the zombie characters. I would like them to turn and chase my character.

    Alot like diablo enemies. They will wander within there parameters until the player gets within a certain range.

    I have set up pathfinding. And when the layout starts the zombies will chase my character around the map. However all zombies that are on the map are chasing. And i would like it to just be zombies near by. Any help would be appreciated.

    What i pretty much have

  • Seems like you aren't picking..

    How are your events set up?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Pretty much what I got now it.

    If zombie has line of sight to player

    System Every 0.1 seconds find path to Player.X Player.Y

    Zombie on pathfinding Path found - Move along path

    Zombie on pathfinding Failed to find path - Find path to Player.X Player.Y

    How this is working currently is the zombies wont chase until I get a certain distance. But once I get that distance all zombies chase. and they do not stop chasing even If I get far enough away

  • Pretty much what I got now it.

    If zombie has line of sight to player

    System Every 0.1 seconds find path to Player.X Player.Y

    Zombie on pathfinding Path found - Move along path

    Zombie on pathfinding Failed to find path - Find path to Player.X Player.Y

    How this is working currently is the zombies wont chase until I get a certain distance. But once I get that distance all zombies chase. and they do not stop chasing even If I get far enough away

    Pretty much or exactly?

    You have no else-events and the zombie is referenced in the event that sets the action?

    No system compares and such?

  • Ok....So thats why I am here asking what to do..

  • Please share your events and/or capx to see what is going wrong..

    Those events sound like they should work..

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