Turn based movement


#1

Hello

In my 2D turn-based strategy game I need pathfinding in order to move my units. Basically, you click on a unit and you set the target which it needs to move to, and then the unit starts moving there 1 or more tile each turn ( think Civilization )
I’m considering using this plugin and my question is how easy it is to implement this kind of movement in my project, do I need to extend it in any way? or is there some sort of a function that I can call in order to get me the target position and then use that in my own code?

Thanks.


#2

Hi

You can check out this tutorial: https://arongranberg.com/astar/docs/turnbased.html
There is also an example scene in the package called ‘Turnbased’ that implements some simple hexagon based movement including limiting the movement range, just like in civ (in the example the units move the whole distance immediately though, not just 1 turn per frame, but that should be relatively easy to change).


#4

Hm… That’s strange, maybe my build script messed something up. It works for me locally.
Try to delete the AstarPathfindingProject folder and import the package again.
If it still doesn’t work, try downloading an older version, and I will make sure it is working in the next update.