I need help with a "enemy danger indicator" logic. It correctly shows enemy position at the side of the screen, but it isn't showing the position correctly when the enemy is behind me.

Here I show the problem on a video:
https://www.youtube.com/watch?v=BkYCJqBJODc&feature=youtu.be