I'm not sure if I understand you right. But if so, then you have to calculate the angle FROM the enemy TO the player, not the other way round.
Scenario:
Player is at (100, 100) with a zone of radius 50. Enemy is at (250, 50)
Now the angle from the player's perspective to the enemy would be ~341.57?. But the angle you need is the one from the enemy's perspective to the player, which is ~161.57
The rule is that the first pair of coordinates in the angle expression has to be the one of whose perspective you're trying to get the angle.
angle(playerXY, enemyXY) => the angle that points towards the enemy
angle(enemyXY, playerXY) => the angle that points towards the player
But that's not all in this case. You also want to move the enemy from its current position to the proximity zone of the player, which in this case is a 50 pixel radius around the player. So you have to SUBTRACT that radius from the total distance between enemy and player.
The enemy calculation would then look something like that:
self.x + cos(angle(self.x, self.y, player.X, player.y)) * (distance(self.x, self,y, player.x, player.y) - 50)
self.y + sin(angle(self.x, self.y, player.X, player.y)) * (distance(self.x, self,y, player.x, player.y) - 50)
You would need to replace 50 by the correct radius.
Works like a charm! Thanks a ton.