update the position of rock from both left and right