How do I make a sprite move like a pendulum

Get help using Construct 2

Post » Thu Jul 30, 2015 10:49 pm

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)
B
4
S
1
Posts: 6
Reputation: 362

Post » Thu Jul 30, 2015 11:52 pm

Something like this
Image Image
B
26
S
15
G
143
Posts: 882
Reputation: 74,562

Post » Fri Jul 31, 2015 1:42 am

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?
B
6
S
2
Posts: 60
Reputation: 1,242

Post » Fri Jul 31, 2015 9:31 am

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 ^^
B
4
S
1
Posts: 6
Reputation: 362

Post » Fri Jul 31, 2015 12:04 pm

quick test (rough)

beta r210

https://db.tt/GYCMjuOR
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
64
S
34
G
47
Posts: 1,194
Reputation: 30,892

Post » Fri Jul 31, 2015 7:09 pm

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.
B
4
S
1
Posts: 6
Reputation: 362

Post » Sat Aug 01, 2015 3:30 pm

@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.

http://www.rieperts.com/games/forum/pendulum.capx

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.
B
99
S
35
G
20
Posts: 438
Reputation: 17,910

Post » Sat Aug 01, 2015 11:30 pm

That works... so well ! Amazingly well :shock: 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 !
B
4
S
1
Posts: 6
Reputation: 362

Post » Sun Aug 02, 2015 7:15 am

@AllanR - nice example, much better than my rough one.
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
64
S
34
G
47
Posts: 1,194
Reputation: 30,892

Post » Sun Aug 02, 2015 1:43 pm

@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...
B
99
S
35
G
20
Posts: 438
Reputation: 17,910

Next

Return to How do I....?

Who is online

Users browsing this forum: dop2000 and 29 guests