The point is that the enemies move together at the same time, so the pathfinding obstacle map is in constant changes.
So I thought about an approach moving the enemies one after another, like a turn based system, so that their pathfinding function would be calculated from a still obstacle map on screen.
The sequence would be so :
- The Enemies don't move.
- each hexagon where an Enemy stands becomes Solid, creating an obstacle map on the screen.
- Pathfinding for Enemy 1 is calculated
- Enemy 1 moves and then stops on a hexagon that becomes Solid. Obstacle map changes.
- Pathfinding for Enemy 2 is calculated from new obstacle map
- enemy 2 moves and then stops on a hexagon that becomes Solid. Obstacle map changes.
- Repeat until every Enemy has moved.
Unfortunately, I'm not good enough programming to achieve this.