0 Favourites

How do I make pathfinding follow a player?

  • So right, I've been having some fun with pathfinding lately, and its really useful. But I got stuck when I got this idea.

    The first thing I did was simply make some obstacles and make some sprites go from point A to point B, but I wanted to go a little further and implement this in a different kind of game. Let's set an easy example, imagine I'm making a Zombie game, (Bird eye view, 8 direction behaviour), so I want the "Zombies" to follow the player as soon as they see him, that's easy, just set it so they find their path only when they have line of sight with the player. The problem is when they find the path to the player they go to the position where they first saw the player. What i mean with this is that they dont actually follow the player but instead go to where the player was. The easiest way to make a sprite follow another is to set its angle towards the player and then make it to move forward, but that way it would be going throught walls...

    I also tried making so the pathfinding finds the path every X seconds, but from what I've seen, that way for some reason doesnt work...

    Any help? <3

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Set it so that on path found, move along path as standard. Then every X seconds find path to player, it should pick up the new location of the player at that point. I could do a simple capx with 2 events to show you that it 'should' work so something has gone wrong in your game logic. In what way is it not working? That'll be the key to finding out where the logic has gone wrong.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
167 14,499
DMT2005's avatar
DMT2005
Unread hot topic
0 Favourites
[plugin] Youtube player
175 20,544
rexrainbow's avatar
rexrainbow
Unread sticky
1 Favourites
C2 Games made with CocoonIO
136 89,826
minhcuong's avatar
minhcuong