I do understand the issue, but it should not happen as the formation makes equal displacement each frame.
consider this:
frame 9:
Enemy formation in bounds. position is still towards right.
frame 10:
Enemy formation steps out of bounds, the direction is then changed to left in this frame.
frame 11;
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 ?