# How do i move a sprite in a perfect circle

Get help using Construct 2

### » Tue May 22, 2012 4:48 pm

I want to simulate the planets moving around the sun , how do i move objects in circles
B
9
S
2
Posts: 100
Reputation: 1,330

### » Tue May 22, 2012 5:11 pm

Extract from the how do I FAQ, "Physics" :
[quote]Simulating gravity affected orbits between celestial objects - LINK[/quote]

"Object moving":
[quote]Make an object rotate around another via events - LINK[/quote]Kyatric2012-05-22 17:12:20
New to Construct ? Where to start

Please attach a capx to any help request or bug report !
Moderator
B
243
S
85
G
39
Posts: 6,943
Reputation: 56,930

### » Tue May 22, 2012 5:24 pm

Thank you very much
B
9
S
2
Posts: 100
Reputation: 1,330

### » Tue May 22, 2012 5:31 pm

can someone just post an example of an event
B
9
S
2
Posts: 100
Reputation: 1,330

### » Tue May 22, 2012 5:36 pm

Post

Be sure to read the links that you are given. Examples are already posted in those threads.Kyatric2012-05-22 17:37:40
New to Construct ? Where to start

Please attach a capx to any help request or bug report !
Moderator
B
243
S
85
G
39
Posts: 6,943
Reputation: 56,930

### » Tue May 22, 2012 5:48 pm

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

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.

kittiewan2012-05-22 17:54:48
B
29
S
11
G
12
Posts: 281
Reputation: 11,858

### » Tue May 22, 2012 6:20 pm

thanks alot you guys the picture helped alot as i was using cc.
B
9
S
2
Posts: 100
Reputation: 1,330

### » Tue May 22, 2012 10:13 pm

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.
B
10
S
3
G
2
Posts: 196
Reputation: 2,053

### » Fri Aug 16, 2013 7:21 pm

@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?

thanks,

Jon
B
3
Posts: 3
Reputation: 206

Return to How do I....?

### Who is online

Users browsing this forum: Energiun, kathleen, tomi71, YoHoho and 32 guests