A* Pathfinding Project

Setting Player as Obstacle


#1

I’m making a top down 2D game using the A* pathfinding project to make enemy ai to attack the player. If the player takes enough damage then i have modified it so that the enemy will go towards the end of the map that is furthest from the player, to give them a chance to safely get away once they are able to move again.

My issue is that if the enemy is positioned specifically when this should happen they get stuck on the player and wont move. Is there a way to specify the player as an obstacle during this time, and then change it back when they’re up?

Thanks


#2

https://arongranberg.com/astar/docs/turnbased.html - The “Blocking nodes” paragraph might be useful.