I’m currently making a 2D flight game and I’m having trouble with the AI.
The AI is going to have to modes, defense and attack.

In locations 1 and 2 the AI will be attacking and in 3 and 4 it will defend, the plane in the middle is the player and the other is the enemy.
I managed to get the angle from the 2 vectors expecting to range from 0 to 360 and that way I’ll limit the zones, however it didn’t.
Instead each of the sections varies from 0-90 and it’s positive in 2 and 3 and negative in 1 and 4.
Can someone give me advise on what to do ? The main objective of this is to know where the enemy is relativly to the player the rest of the code is done …
Here is the code I used:
Alpha = (Mathf.Atan((enemy.z - player.z)/(enemy.x - player.x)) * Mathf.Rad2Deg