The offset occurs because the new direction is set, before all the cubes have moved.
The way to solve this is to put this before the "For mov1.mov = Each mov" loop:
newdirection# = direction
And when the new direction is set, use:
If mov1\x > 3.9 Then newdirection = -0.01
If mov1\x < -3.9 Then newdirection = 0.01
Finally, after the loop use:
direction = newdirection
The way to solve this is to put this before the "For mov1.mov = Each mov" loop:
newdirection# = direction
And when the new direction is set, use:
If mov1\x > 3.9 Then newdirection = -0.01
If mov1\x < -3.9 Then newdirection = 0.01
Finally, after the loop use:
direction = newdirection