Dynamic Pathfinding

Get help using Construct 2

Post » Tue Jun 24, 2014 8:42 am

Probably many of you have had this problem also, if you're using pathfinding:

You have one object moving along its path, and another object gets in the way, and the first object either simply passes through the second, or if you have some "bumping code" set up pushes the second one out of the way.

My question is this: is it possible to have dynamic pathfinding? So that the first object recalculates a new path? I thought of a method, but I'm not sure its possible or CPU friendly. If you were to create an invisible sprite line from object to the x/y its moving to, and another object crosses that line, I'm guessing its possible for the first object to recalculate a new path to the x/y point.

Has anyone created something like this? Can you please post an example capx? Many thanks! :)

Edit: An example of how I wish it to work correctly is kind of like you can see in League of Legends, where the champions avoid minions and other obstacles reasonably (i.e. they still will try to push through enemy minions if its the shortest path, but ALWAYS avoid solid walls).
Btw: In LoL, I was able to make a champion walk through the walls because they seem to have a similar pathfinding problems ^^
B
20
S
6
G
2
Posts: 91
Reputation: 4,597

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 8 guests