Limiting atan2 to specific angle ranges
问题 I want my Player sprite to rotate following the position of the mouse cursor. I'm using atan2 to set up a 360 degree rotation action script for my Player sprite. atan2(XMouse-XPlayer,YMouse-YPlayer) - 90 Using this, 90 degrees is straight up, 0 is direct right, 270 degrees is straight down. I need the Player sprite to sit on the Left side of the screen and only face the Right side of the screen when it rotates (meaning it can't look backwards). I need to limit my angles to both conditions;