# Math formula to get new position coordinates?

Get help using Construct 2

### » Mon Dec 29, 2014 1:55 am

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.
B
46
S
23
G
31
Posts: 693
Reputation: 20,637

### » Mon Dec 29, 2014 3:07 am

it should work with no math knowledge to if you use image points

https://www.scirra.com/manual/63/image-points
yeah, i really like to say that you should "Read this:"
B
16
S
8
Posts: 140
Reputation: 1,899

### » Mon Dec 29, 2014 5:47 am

Hmm....I honestly never thought of using imagepoints, but if I use three image points and always maintain the correct angle for the ball, I think it just might work. TIme to try it out! Thanks!
B
46
S
23
G
31
Posts: 693
Reputation: 20,637

### » Mon Dec 29, 2014 6:40 am

Or you could go the lazy route and just make an animation like [O ] [ O] pin it at the contour and on switch set the animation frames with abs(currentframe-1) for example - they will auto flip in one event.
B
19
S
6
G
7
Posts: 1,101
Reputation: 6,146

### » Mon Dec 29, 2014 10:07 am

Thanks for the tip @Somebody. Right now the imagepoints work perfectly so I am sticking with it for now, but it is always good to learn new approaches and methods. Thanks!
B
46
S
23
G
31
Posts: 693
Reputation: 20,637