Jump to content
  • Advertisement
Sign in to follow this  
kaizermario

Path Finding

This topic is 4324 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm making a Turn Based Estrategy and I need some help with path finding. The moving action will be like Final Fantasy Tactics and Fire Emblem, will be shown to the player some squares in the map, then, the player click on a square and the Sprite must get the shortest way from the spot it was to the spot that the player clicked. I would like some help too to make a code that generates those squares, like, if the movement of the sprite is about 5 squares, I need to make a code that circundate the sprite with those squares, like, 5 for the left of the sprite, 5 for the right, 5 above and 5 below, and the diagonals must be placed with move-squares too. Thanks

Share this post


Link to post
Share on other sites
Advertisement
Use Dijkstra's pathfinding algorithm, centered on the current position of the unit, to determine the set of tiles that it can reach in one move as well as the path (and the path length) to follow to get to each of these tiles. You can then display accessible tiles, or have the unit follow a path to a clicked area.

Share this post


Link to post
Share on other sites
I used someone else's A* pathfinding code and it broke my game. :(

I finally decided to write my own which is much better because I now know exactly how to manipulate the code for paths not found, characters blocking paths, when to crowd in and when to find another route etc. I struggled a bit to start with, but writing it all out on graph paper first made it much easier to understand and was a good exercise for me.

Good luck with it!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!