If you had an origin point at the inner end of the gun barrel (eg. where the barrel meets the tower) then I guess you could measure the angle from the turret to the enemy like so:
And basically work out the angles like:
If angle between turret and enemy is between 45-55 degrees: set animation to rightmost
If angle between turret and enemy is between 55-65 degrees: set animation to middle-right
Alternatively, for a more simplified version, you could compare the X values of the turret and the enemy. If all you needed was the 3 states of left/middle/right, you could work that out by testing to see if the enemy was more than a certain distance to the left or to the right of the turret origin.
Eg. you could have these 3 events:
If enemy.x < turret.x - set turret animation to LEFT
If enemy.x > turret.x - set turret animation to RIGHT
If enemy.x is between values turret.x-20 & turret.x+20 - set turret animation to MIDDLE
This will cause the turret to point left or right if the enemy is to the left or right of its origin point, unless they are standing somewhere in the middle zone, in which case it plays the middle facing animation.
I've allowed 20 pixels either way to be the turret's middle zone, but you can adjust this number based on the size of your sprites and what looks good in practice.