Circle Movement?

    Hey all, do you have a good idea how to make a circle movement using sine or something else?

    Here's a way:

    circularMovement.capx (r99)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads

    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

    Hey Nimtrix and TELLES0808 Thanks for helping me :D!

    What about circle movement with pathfinding?

    What about circle movement with pathfinding?

    Farsight Use animation to make fake circle animation, you wouldn't alternate the pathfinding movement using sine behavior

    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 <img src="smileys/smiley1.gif" border="0" align="middle" />

    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.

    Thank you Nimtrix...

    And please explain me to rotate the same object in reverse order... which you provided in the sample..

    - try subtracting dt rather adding dt to t.

    Thank you Nimtrix...

    And please explain me to rotate the same object in reverse order... which you provided in the sample..

    Just change the sin and cos around.

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