# Math formula to get new position coordinates?

0 favourites
• 5 posts
From the Asset Store
Aliens are invading our planet! Solve the math question, and attack the alien with your laser. Covers addition, subtract
• 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.

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

https://www.scirra.com/manual/63/image-points

• 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!

• 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.

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• Thanks for the tip 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!

• 5 posts