0 Favourites

How do I make a sprite move like a pendulum

  • Hello, I'm new here ! I made my presentation in the topic provided.

    My problem is that I'm trying to create a platformer where, when the right button is down on a particular sprite, your character can hang on this sprite (that don't move, don't have behavior etc.) then move like the most heavy part of a pendulum as long as the right button is down. There's some exemples with the Zelda serie (like the whip in spirit tracks (you can look for a video) but keeping the same distance between the character and the sprite than when you started to click). I'm really new on construct 2 so I don't know if I should put that question in beginner but I looked for the same problem on the question frequently asked topic (impressive work, really °O°¨), and I didn't find it...

    Thank you for reading and thank you in advance if you help me. I hope that I'm easily understandable (I'm french and -even in french- I'm not always clear)

  • Something like this

  • Uhh.. is it just me or..

    MadSpy was that supposed to be a Capx file? Because I seem to be only able to play it in browser.

    Did you use LERP for that?

  • Not exactly, I want a more realistic physic... In fact a pendulum is more quick when it arrives at the lowest point. I did an animation to illustrate what I want to do : http://s1117#photobucket#com/user/Miari_Rat/media/Prise-3_zpsk9rqtazq#gif#html?o=0 (I can't put an url because I'm a newcomer so please replace the "#" by ".")

    But other than that, yeah, that's what I want to do So thank you for your answer. Can you share the capx file, so we would all be able to understand how you did that ^^

  • quick test (rough)

    beta r210

  • Thanks a lot, it's really useful. The sine behavior is exactly what I needed !! But it's not exactly what I wanted : In fact, I want the spPlayer to be the spPendulum since the right mouse is down at the a sprite that I will call "spRef", and I want the player to turn around this sprite, at the distance with the spRef that the spPlayer had when the right mouse began to click. So please can you tell me if it is possible to edit a sprite origin in the eventsheet and if it is, haw can I do that ? If it's possible, I should be able to do what I want and I will share it to you.

  • Miari

    I modified RamPackWobble's capx to do what you wanted. There were a number of tricky things to handle to make it work properly - like what to do if you release the player while he is in the middle of a platform, being able to handle multiple spRef points, I had to add a small Wait because Construct2 occasionally flashed the player at the wrong point along the arc.


    There are no physics involved - so the pendulum action never slows down, and there is no momentum when you release the player... but other than that, it works well.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • That works... so well ! Amazingly well Thanks a lot AllanR !! I'll try to do my best with this ! First of all, I'll try to understand how does that work ! It's beautiful ! I also tried with RamPackWooble but it didn't work at all in fact ^^' For the problem of the player released in the middle of a platform, I thought that will stop him and he will simply fall, but I can do it by myself ! I'll sent the final capx when it'll be done. I'm not really quick so that probably will be in 5 or 6 days. Once again, thanks a lot everybody, you were really kind to help me like that !

  • AllanR - nice example, much better than my rough one.

  • RamPackWobble Thanks, but you did half the work - I used your capx, your objects, and sine settings. I just flattened the pendulum into a line and made it work in response to mouse input rather than on collision with the pendulum...

  • I finished it, but I don't know how to share my work. Please, explain me, and I'll do it It's not perfectly clean. There are bugs and I think I could have done it more easily but I don't know the software enough so... I tried my best, be indulgent, please.

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