# How do I Get an object to move around in a circle?

Get help using Construct 2

### » Mon Nov 14, 2016 7:37 am

This is probably something very simple, but I'm not very experienced, so I'm not sure how to do this. I'd say that I'm somewhere in the upper range between a beginner and an Intermediate. I believe I know enough to understand any suggestions.

B
25
S
9
Posts: 121
Reputation: 2,053

### » Mon Nov 14, 2016 9:09 am

I'm probably more of a beginner, so maybe this is bad advice ^,^ ;

As I understand it, the thing you are trying to do can be solved with a bit of clever maths being used to create an offset.

But my math is weak, and I suspect that approach is better suited to more code heavy environments, so instead, This is what I would do:

Create an invisible sprite to serve as the radius, with it's origin and next image point being the distance between the two objects. Set this arm's position to the object you want to be rotated around and attach the rotating object to it's image point. Rotate the arm ( I think using Sine movement behaviour on the angle property would be the easiest way of getting this result, but I haven't tried that before.)
B
8
S
2
Posts: 32
Reputation: 620

### » Mon Nov 14, 2016 9:15 am

damousey wrote:I'm probably more of a beginner, so maybe this is bad advice ^,^ ;

As I understand it, the thing you are trying to do can be solved with a bit of clever maths being used to create an offset.

But my math is weak, and I suspect that approach is better suited to more code heavy environments, so instead, This is what I would do:

Create an invisible sprite to serve as the radius, with it's origin and next image point being the distance between the two objects. Set this arm's position to the object you want to be rotated around and attach the rotating object to it's image point. Rotate the arm ( I think using Sine movement behaviour on the angle property would be the easiest way of getting this result, but I haven't tried that before.)

Sounds a biiit complicated, but I'll give it a shot!
B
25
S
9
Posts: 121
Reputation: 2,053

### » Mon Nov 14, 2016 9:23 am

The easiest way is to give the object two sine-behaviors. One has movement horizontal the other vertical.
Both have sine, both have the same period time. Now set on only one the period offset to a quarter of the period time (If the period time is 4 set the offset to 1). Use the vertical or the horizontal with offset, depending on the direction you want the object moves (left or right). To change speed change period and period offset.
B
24
S
3
G
1
Posts: 474
Reputation: 2,211

### » Mon Nov 14, 2016 9:39 am

I made an example to test my idea

rotator.capx

an if you want it's angle to point forward:

rotatorwithangle.capx
B
8
S
2
Posts: 32
Reputation: 620

### » Mon Nov 14, 2016 9:49 am

Asmodean, I like your idea for it's extra flexibility, you could subtly vary values and have very organic orbits, for example, nice!
B
8
S
2
Posts: 32
Reputation: 620

### » Mon Nov 14, 2016 9:52 am

It's not really my idea. I read it a long time ago here in the forum. But I didn't finde the thread anymore.
B
24
S
3
G
1
Posts: 474
Reputation: 2,211

### » Mon Nov 14, 2016 9:56 am

Asmodean wrote:It's not really my idea. I read it a long time ago here in the forum. But I didn't finde the thread anymore.

Thanks for that info! Wow I knew it was easy! Thanks a lot!
B
25
S
9
Posts: 121
Reputation: 2,053