6 hours ago, LazyDev said:After a while, the player can only turn left for some reason ?
This should work, independent of how many revolutions the input angles have:
int rot = (to_angle - from_angle) % 360;
if (rot<0) rot += 360;
return (rot < 180 ? 1 : -1); // eventually flip the sign, depending on what you expect
I wonder why you use degrees and integers for angles.
I suggest using 2D direction vectors or complex numbers over angles too. It eliminates worries about angle ranges and more importantly a lot of expensive trig operations, depending on what you do.