Hi, I want to add grid movement for AI in some examples I found, but I don't know how. I tried to make it work, but the player and the AI overlap each other at one point or another. So, whats the best way to implement grid movement for a moving ai character so that the player doesn't overlap with the AI?
As far as I can tell, this has nothing to do with pathfinding or AI - it's just grid based movement.
You just need to use a detector object. If the player presses "right" you place the detector in the square to the right of where the player is currently standing. If it overlaps another object then don't move the player. You can make the detector object act as a barrier to the AI character so that they and the player can't both move onto the same square.