Support Forum

How to calculate remaining moves in turn-based game?

Hello there.

If I have a turn-based game where, for example, unit can travel 5 nodes in all directions.
After unit move 1 node, I want him to be able to move 4 more, so how can I get remaining value for calculating possible moves for my unit?

In an example I see this:
var path = ConstantPath.Construct(unit.transform.position, unit.movementPoints * 1000 + 1);

So, I suppose, I should somehow calculate remaining movement points for path calculations. Any suggestions?

Hi

Tracking remaining moves is very much game-logic, and not something this package will track. If you know that you move the agent 1 node, cannot you use that to subtract 1 from a counter that you handle?

But, if my game field is squares, not hexes, I need to substract moves by some cost value.
Going into the top-right square cost more then going just top.

But I’ve got your point.

Thanks for you answers!

1 Like