What I am trying to achieve is: When the player clicks on something, all the red balls will change their position to that represented by the yellow balls. And when the player clicks again, it changes its position back, and so on.
Let's say that the balls are 128 pixels in width and length, and the black line separating it from its new position is 16 pixels. What is the formula I would need to use if I wanted the red balls to go to the positions shown by the yellow balls? The black shape is made out of the same sprites, but each with an adjustment to its angle, so the angle can be easily obtained for the formula.
I am not that good in maths, so any help would be greatly appreciated.