Circle Movement?

Get help using Construct 2

Post » 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
96
S
25
G
20
Posts: 3,055
Reputation: 22,644

Post » Wed Aug 15, 2012 11:12 pm

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

Post » Wed Aug 15, 2012 11:24 pm

You can do a math.

How to do:
create instance radians = 0;
create instance degrees= 0;
create instance radius = 100; // random radius
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
ImageImageImageImageImageImage
B
93
S
20
G
13
Posts: 1,217
Reputation: 18,996

Post » Thu Aug 16, 2012 8:42 pm

Hey @Nimtrix and @TELLES0808 Thanks for helping me :D!
B
96
S
25
G
20
Posts: 3,055
Reputation: 22,644

Post » Thu Aug 15, 2013 8:54 am

What about circle movement with pathfinding?
Creator of MiniDayZ
B
19
S
2
G
2
Posts: 61
Reputation: 1,755

Post » 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
96
S
25
G
20
Posts: 3,055
Reputation: 22,644

Post » 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
19
S
2
G
2
Posts: 61
Reputation: 1,755

Post » Fri Aug 21, 2015 5:34 am

TELLES0808 wrote:You can do a math.

How to do:
create instance radians = 0;
create instance degrees= 0;
create instance radius = 100; // random radius
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

Post » 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

Post » 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
59
S
30
G
34
Posts: 1,194
Reputation: 23,777

Next

Return to How do I....?

Who is online

Users browsing this forum: DemantDigitalArt, farfetchd83, mjj1990 and 5 guests