How do i move a sprite in a perfect circle

0 favourites
  • 9 posts
From the Asset Store
Particles support animations, collisions, effects and etc.
  • I want to simulate the planets moving around the sun , how do i move objects in circles

  • Extract from the how do I FAQ, "Physics" :

    imulating gravity affected orbits between celestial objects - LINK

    "Object moving":

    ake an object rotate around another via events - LINKedited><editid>Kyatric</editid><editdate>2012-05-22 17:12:20</editdate></edited>

  • Thank you very much

  • can someone just post an example of an event

  • Post

    Be sure to read the links that you are given. Examples are already posted in those threads.

  • Hmmm. Not sure what more you want, but here is a picture of the pertinent part of the event sheet from Jailson's example (the second one Kyatric linked to above.)

    <img src="" border="0" />

    The first action in the Every Tick event is the one that makes the orbit.

    The two global variables, radius and speed, are required since they are used in the first action. Radius of course is the distance of the orbiting object from the center point, and speed is the speed at which it travels in its orbit.

    Centerpoint is object about which other objects orbit (in your case it would be the sun.) Object is the object in orbit. (In your case it would be a planet.)

    The second action angles the object to follow the orbit path as it moves around the centerpoint. For a round object like a planet, you may not need. Instead you might put a rotate behavior on your planet to make it rotate on its axis as it travels about the sun.

  • thanks alot you guys the picture helped alot as i was using cc.

  • A quick and simple alternative in case you're interested. Simply add two sine behaviors to the object you want to move in a circle. Make the two behaviors identical except make one vertical and one horizontal. Also, choose one of them and change the period offset to 1/4 the period. Done!

    To tweak, you can change magnitude to change the radius of the circle, or make the magnitude negative to change the direction of movement. Just make sure when you change a parameter, change it on both sine behaviors. The two should be identical except for direction of movement and period offset.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Dalal, this is exactly what I was hoping to find, but I'm having a hard to imagining the event sheet for sine. Are you saying that I have the sprites x set to the sines horizontal and the sprites y set to the sines vertical movement? Also why do we need to change the period to be 1/4?



Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)