I do understand the issue, but it should not happen as the formation makes equal displacement each frame.
Enemy formation in bounds. position is still towards right.
Enemy formation steps out of bounds, the direction is then changed to left in this frame.
Enemy formation steps back in the bounds( same position as frame 9), the direction should not be changed in this frame now.
Here’s it visually
I know that splitting the direction flipping (LEFT+RIGHT) check into separate left and right direction setting checks does solve the issue, but the combined check should be working fine mathematically, but doesn’t. could it be due to rounding of float data type ?