How do I pathfind on an incomplete path?

Get help using Construct 2

Post » Mon Apr 27, 2015 9:12 am

Message: mikey555 is not yet permitted to post plain text URLS (300 rep required). 1 URLS removed. Why?
I'm making a game where the player is building a railroad track on a tilemap layout and the train starts running, forcing you to build the track as fast as you can until you get to the goal.

I'm having trouble figuring out how the train will find its path to take along the track. Since the track is never connected to the goal, I'm stumped on how to pathfind.

I saw this () great post from a few days ago about a behavior plugin, but I'm not sure if I can use it because a complete path won't be possible.

Does anyone have an idea about how to approach this?
Thanks so much!
B
4
Posts: 5
Reputation: 210

Post » Mon Apr 27, 2015 1:04 pm

Are you sure you really need a 'proper' pathfinder? Would it not be possible to use a more basic waypoint system? Each time you put down a track it adds it self to the trains waypoint list.
Then, whenever the train reaches the end of the waypoint list, you lose.
B
5
Posts: 19
Reputation: 263

Post » Mon Apr 27, 2015 2:33 pm

I believe you were talking about my tilemap behavior ? You could probably still use it. Simply set the cost of any non-track tile to something absurdly high. Doing so, a path will always exists, you'll simply have to detect when your train step on a non-track tile so it explodes to smithereens !
B
76
S
31
G
27
Posts: 1,015
Reputation: 20,790

Post » Fri May 01, 2015 1:31 am

Thanks for the help guys. I think my method was way too complicated so I'm deciding to treat the rail pieces as a sort of linked list where the actual path is not known, only the direction in and out of the rail piece.

Magistross, thanks so much for the behavior!
B
4
Posts: 5
Reputation: 210


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 11 guests