Only applying movement change only when overlapping object
Hello, I'm working on a top-down shooter game, and I created an enemy which shoots at the player when it is overlapping an invisible square that follows the player, and I've been trying to make it so that when it's overlapping the square, it stops moving, but when the player moves away taking the square with it, the enemy starts moving again to get closer to the player and shoot it.
The problem I have is that, yes, the enemy follows the player and stops moving and starts shooting when it overlaps the square, but when I move away, the enemy does not try to move, so the only way to get shot is getting close to it.
If you know how to fix this, please tell me.
Thank you!