How do I pathfind on an incomplete path?

0 favourites
  • 4 posts
From the Asset Store
Run, jump over or on enemies and reach the path’s end as fast as you can!
  • 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!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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 !

  • 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!

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