I am working on a few different AIs for a tile-based game. I'm trying to figure out one where that tries to keep a certain distance from the player. So if distance becomes small, move away.
The whole game is in a pretty small are so it can't just forever move away. The movement is 4 directional.
How do I make the AI keep going at a distance, and once caught in a corner or close to a side of the room, to ignore the rule and just try to go around the player to the other side of the room?
the safe tiles (white) are behind the player