Pendulum

1 favourites
  • 7 posts
  • I need do something with Pendulum and I have no clue how to start it from Construct object.

    Tell me a suggestion, I have to write my own plugin or combine it from existed...???

  • 1. Add a sprite of your pendulum.

    2. In the image editor move the origin to where you want to pivot.

    3. Add the sine behavior to the sprite.

    4. Change "Movement" to "Angle".

    5. Profit

    6. Tweak settings to your liking.

  • Physics would also work ;)

  • Thank so much R0J0hound

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • R0J0hound Wow that still worked, thank you so much. Am I wondering though is there a way to make it swing a few swings and then gradually slow down and stop in place until it is activated again?

    Thank you in advance...

  • If using the sine behaviour, a simple way is to set the pendulum's sine magnitude to max(self.sine.magnitude-value,0) every tick, where "value" is the rate at which you want the pendulum to slow down.

    You can then do a check to see if the magnitude is 0 and disable the sine behaviour to stop it running.

  • You can not use any behaviors if you like. Create a sprite and make the image origin to the left.

    Then give the sprite a variable called "w" and create an event like this:

    every tick:

    --- sprite: add cos(self.angle)*500*dt - self.w*0.001

    --- sprite: rotate self.w*dt degrees clockwise

    "w" is the angular velocity of the object.

    500 is the gravity. Change it to adjust the speed things go.

    0.001 is the damping. Make it lower to allow the pendulum to swing longer before it stops.

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