Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Drawing a 2D physics rope

Author
Message
IronManhood
9
Years of Service
User Offline
Joined: 6th Feb 2015
Location: US
Posted: 11th Jun 2018 13:07
Recently I wrote a method for creating 2D physics ropes. Essentially, it's just an array of points and I'm using sprites to draw them at the moment. But when the ropes are stretched the sprites separate and there are gaps. Does anyone know of a fancy way to render ropes?
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 11th Jun 2018 16:23
You could test the gap between sprites and resize them. Or draw between the points using DrawLine. It might be that you can stop the gaps from happening by changing the physics scale.
Using AppGameKit V2 Tier 1
IronManhood
9
Years of Service
User Offline
Joined: 6th Feb 2015
Location: US
Posted: 12th Jun 2018 12:57
Here's what they look like so far.

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 12th Jun 2018 15:57
I couldn't see any gaps or stretching in your video, but it sounds like you need to tighten the restraints on the connected points. With 0 tolerance given between the anchor points of each segment, it should prevent any sort of stretchyness.

The other option (and visually I think the best option) would be as baxlash said, resize the sprites to match the distance between points.
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 13th Jun 2018 19:14
Another suggestion to avoid the "stickiness" that these ropes seem to have is to set the friction to zero. I would possibly reduce the length of the segments too. Other than that it looks great! Love the colours too!
Using AppGameKit V2 Tier 1
puzzler2018
User Banned
Posted: 13th Jun 2018 20:40 Edited at: 13th Jun 2018 20:43
I subscribed to this master, seems to have just the ticket for what you trying to achieve, plus 100s more





https://www.youtube.com/channel/UCvjgXvBlbQiydffZU7m1_aw

OK, he codes in Java PS - but the coding can be easily converted to AppGameKit with simple programming know how


IronManhood
9
Years of Service
User Offline
Joined: 6th Feb 2015
Location: US
Posted: 14th Jun 2018 06:41
Here's what they look like after some changes. They're drawn with DrawLine() and I decreased the physics shape sizes. No more gaps but there are still some issues.

Rick Nasher
7
Years of Service
User Offline
Joined: 25th Jul 2017
Location: Amsterdam
Posted: 14th Jun 2018 17:56
Fascinated by the swinging rope since the release of Pitfall.. But it surely has come a long way since then. Good to see. Hope you succeed in your quest.
basicFanatic
7
Years of Service
User Offline
Joined: 7th Jun 2017
Location:
Posted: 18th Jun 2018 14:41 Edited at: 18th Jun 2018 14:43
Inspired me to try to code some 3D rope. But I only managed 10 chains. More than that and the thing explodes.

The best swinging rope I have seen is the one in Fury of the Furries:
https://youtu.be/Wc3XxSp0wXc?t=17m3s

Login to post a reply

Server time is: 2024-11-23 20:37:37
Your offset time is: 2024-11-23 20:37:37