How to make an enemy move randomly but closer to the player

I am making a top-down dungeon crawler, and I have a boss that will follow the player but every once in a while it will move randomly to make the boss more unpredictable, I have this code figured out but I want it to move in the general direction of the player instead of moving in a random direction. I have like half the code figured out but idk what to do next

Btw the if statement at the top that goes out of frame is just the code that decides the proximity the player must be in in order for the boss to follow the player so dw about that.

2 Likes

Instead of making it follow the player, you could use the chase 0 code and add a bit of randomness to the angle of the boss to the player