# Circle Movement?

Get help using Construct 2

### » Wed Aug 15, 2012 10:45 pm

Hey all, do you have a good idea how to make a circle movement using sine or something else?
B
104
S
29
G
22
Posts: 3,066
Reputation: 24,273

### » Wed Aug 15, 2012 11:12 pm

B
27
S
8
G
8
Posts: 903
Reputation: 8,452

### » Wed Aug 15, 2012 11:24 pm

You can do a math.

How to do:
create instance degrees= 0;
initial.x = 50; // random primary x position
initial.y = 50; // random primary y position

Every Thick
degrees = degrees + 5; // each time degrees is increased by 5 degrees
radians = degrees * Math.PI/ 180;
sprite.y = initial.y + Math.sin(radians) * radius // because sin A = y/r
sprite.x = initial.x + Math.cos(radians) * radius // because cos A = x/r

B
95
S
21
G
16
Posts: 1,337
Reputation: 20,955

### » Thu Aug 16, 2012 8:42 pm

Hey @Nimtrix and @TELLES0808 Thanks for helping me :D!
B
104
S
29
G
22
Posts: 3,066
Reputation: 24,273

### » Thu Aug 15, 2013 8:54 am

What about circle movement with pathfinding?
Creator of MiniDayZ
B
20
S
2
G
2
Posts: 67
Reputation: 1,792

### » Thu Aug 15, 2013 9:09 pm

[QUOTE=Farsight] What about circle movement with pathfinding?[/QUOTE]
@Farsight Use animation to make fake circle animation, you wouldn't alternate the pathfinding movement using sine behavior
B
104
S
29
G
22
Posts: 3,066
Reputation: 24,273

### » Wed Sep 11, 2013 9:23 am

i already find another way without pathfinding) i create big circle sprite, its invisible on start and have spin behavior. And when unit appears its pin to circle
Creator of MiniDayZ
B
20
S
2
G
2
Posts: 67
Reputation: 1,792

### » Fri Aug 21, 2015 5:34 am

TELLES0808 wrote:You can do a math.

How to do:
create instance degrees= 0;
initial.x = 50; // random primary x position
initial.y = 50; // random primary y position

Every Thick
degrees = degrees + 5; // each time degrees is increased by 5 degrees
radians = degrees * Math.PI/ 180;
sprite.y = initial.y + Math.sin(radians) * radius // because sin A = y/r
sprite.x = initial.x + Math.cos(radians) * radius // because cos A = x/r

I've been struggling to get this circular movement right, and finally your solution worked best for me..Thanks a lot.
B
8
S
1
Posts: 40
Reputation: 863

### » Wed Oct 14, 2015 9:28 am

Thank you Nimtrix...

And please explain me to rotate the same object in reverse order... which you provided in the sample..
B
5
Posts: 5
Reputation: 246

### » Wed Oct 14, 2015 10:34 am

@nanag32 - try subtracting dt rather adding dt to t.
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
62
S
31
G
39
Posts: 1,194
Reputation: 26,482

Next