Rope physics between pegs

Get help using Construct 2

Post » Thu Feb 21, 2013 10:32 am

Hi All

I'm experimenting with making a game where you can place two pegs to create a physics-enabled rope between them.

I have been going round in circles and wondered if anyone could take a look?

http://dl.dropbox.com/u/116137178/GamesDev/Bridge/Bridge.capx

As far as I can see the while loop is not executing.
I'm trying to make it loop until I have spawned enough rope pieces between the two pegs, and stop once I'm over the destination peg.

So the logic I've tried to use it "do whilst the most recently added rope segment is not overlapping the destination peg"
B
20
S
6
G
2
Posts: 157
Reputation: 3,109

Post » Thu Feb 21, 2013 12:07 pm

I've bought a license and written a version using families to pin each rope section to the last. Still no joy though :(

http://dl.dropbox.com/u/116137178/GamesDev/Bridge2/Bridge2.capx
B
20
S
6
G
2
Posts: 157
Reputation: 3,109

Post » Thu Feb 21, 2013 1:00 pm

Hi,


I changed the While to Every 0.5 seconds to see whats happening.

Looks like its working.

Will have a better look later if this doesnt help.

Edit:
I dont know why you have the fade behavour on the rope but i dont think it likes the physics behavour.spongehammer2013-02-21 16:35:48
B
45
S
15
G
9
Posts: 1,096
Reputation: 11,038

Post » Fri Feb 22, 2013 9:48 am

I want ropes to fade/destroy once they aren't pinned to a peg anywhere down the entire set of ropes.

But for now I'd be happy if I could just see a rope bridge appear between two points, with each rope segment affected by gravity (for e.g. for a player to walk across and it would bulge).
B
20
S
6
G
2
Posts: 157
Reputation: 3,109

Post » Fri Feb 22, 2013 2:57 pm

:) I'm having a headache because of thinking of your problem... Since yesterday I'm trying and trying different combinations but no success until now... Damn, it sounds so easy...
B
11
S
3
G
3
Posts: 79
Reputation: 3,343

Post » Fri Feb 22, 2013 6:31 pm

Hi.

See this post:
http://www.scirra.com/forum/laser_topic56645_page1.html?KW=Laser

You can create the rope, like the laser.

the example:
http://www.scirra.com/arcade/example/1853/laser-gun-effect
B
17
S
3
G
1
Posts: 19
Reputation: 1,940

Post » Fri Feb 22, 2013 6:40 pm

The problem is newly created objects aren't properly created until the next top-level event (see this). Which means you can't pick those rope parts by UID until after event 2 has finished completely. You might try creating all the rope parts first and then looping through them and joining them together in the next top-level event. For example: physicsBridge.capx (r119)
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,020

Post » Sat Feb 23, 2013 12:37 pm

I appreciate the comments so far but still don't understand.

I've looked at the issue highlighted in that post ramones but as far as I see my code doesn't do that. It uses nested functions, all effectively fired "within" event 4.

Mouse Click (event 2)
Sub-event 4 create peg, pin to wall. Call Create Brige
     "Create Bridge"
        "Add Bridge" (loop)

Do functions not work like this? In my head they'd have the above nesting. In the event sheet they show as top level events.

I've also looked at your bridge example (thanks btw) and if need be I'll try rewrite mine to work the same (assuming I can with dynamic pegs), though I'm still stumped over why it isn't working through functions.
B
20
S
6
G
2
Posts: 157
Reputation: 3,109

Post » Sat Feb 23, 2013 1:12 pm

Functions have their own picking though. Picked objects don't stay picked when you call a function. But they don't count as top level events for object creation either.

So the peg you create in event 3 can't be picked in the "CreateBridge" function in event 8. And the ropes spawned in the "AddRope" function can't be picked in event 8. Any object you create in event 2 or in the two functions called can't be repicked until event 2 finishes.
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,020

Post » Sat Feb 23, 2013 2:50 pm

Thanks for help so far. I've stripped the functions out and tried to follow a similar structure to yours. Was almost getting somewhere but now I am scratching my head over event number 4 in this one.

It isn't getting the Source peg, even though it was created in top level event #1 and I'm looking for it in another top level event #2.

Have debugged a bit more and Dest Peg gets picked fine.

http://dl.dropbox.com/u/116137178/GamesDev/Bridge3/Bridge3.capx


B
20
S
6
G
2
Posts: 157
Reputation: 3,109

Next

Return to How do I....?

Who is online

Users browsing this forum: farfetchd83, mjj1990, Yahoo [Bot] and 4 guests