How do I make pathfinding follow a player?

Get help using Construct 2

Post » Sat Aug 26, 2017 11:59 am

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
B
4
S
1
Posts: 23
Reputation: 394

Post » Sun Aug 27, 2017 7:29 pm

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.
B
53
S
21
G
94
Posts: 2,425
Reputation: 55,563


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 5 guests