Lengthening / shortening a distance joint?

Get help using Construct 2

Post » Sat Jul 13, 2013 9:37 pm

Hello, all! This is my first time posting here asking for help, and I do hope that I'm able to adequately explain my dilemma.

I've had a game idea kicking around in my head for a while for a platformer game that mainly centers around the use of a "grappling hook" that can affix to any surface, allowing the player to swing around and traverse the landscape. The idea was that the length of the "rope" binding the player to the grappling hook would be set when the anchor hits the wall, and exceeding that length would cause the player to swing.

I tried creating a distance joint, which allowed for smooth swinging, but behaved unrealistically when the player was above the anchor point, as the bond was supposed to be more reminiscent of a rope than a rigid pole - when firing the grappling hook at the ground, the player should simply fall towards it as normal.

Next, I tried rigging a "bungee" style system, where the physics would create a force pushing the player towards the anchor when exceeding the bond's length. Unfortunately, while this behaved more accurately for a "rope" style bond, it created erratic swinging patterns that were difficult to control.

Ultimately, I created a "hybrid" system, where the bond behaves as a distance joint when the player is below the anchor, and a "bungee" bond when the player is above the anchor. Ultimately it worked out pretty well.


Here's the testing engine I put together, with some really basic rudimentary controls. A and D move the player left and right, W "jumps", and clicking and holding the mouse button binds the player to the green "anchor" square, allowing them to swing around. While swinging, A and D create slight left and right momentum.

Now, here's the problem - part of the controls I want for this game include shortening and lengthening the bond while swinging, so that you can grapple ceilings and high walls and then pull yourself up, or safely rappel down into pits. Unfortunately, there doesn't seem to be a way to smoothly lengthen and shorten a distance bond, while keeping the "swinging" motion intact.

Does anyone have any suggestions? I'm also open to discarding the system I've rigged in favor of another one that would accurately exhibit the behavior I described.

Thanks in advance for your help!
Posts: 28
Reputation: 649

Post » Thu May 08, 2014 7:38 pm

I just wanted to say that your example is very impressive! Thank you very much for sharing it :)
composer - multimedia artist
Posts: 1,146
Reputation: 10,379

Return to How do I....?

Who is online

Users browsing this forum: jbr190 and 45 guests