Rope physics between pegs

Get help using Construct 2

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

Post » Sat Feb 23, 2013 4:00 pm

You need a 'System: Pick all Peg' in event 4 before you can pick the source Peg because the Peg created in event 3 will be the only one picked at that point.

You're still going to have a problem creating Ropes in a loop. Picking 'Ropes instance Ropes.Count - 1' isn't going to pick the last Rope created inside the loop. You should probably store the x,y values in global variables instead.
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,000

Post » Sun Feb 24, 2013 10:22 am

Ah so "pick" is actually like a "filter" in the sense that if you filter more than once you are constantly working with a reduced set of objects.

And that applies not only to the pick command but to any conditional checks which also select specific instances of objects.

You've probably noticed I'm quite new to c2 ;)

I'll have another stab at this and post an update later. Am engrossed in a second game right now.

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

Post » Sun Feb 24, 2013 5:00 pm

Yeah exactly, at the start of each top-level event all objects are picked/selected and any actions apply to all of them. Then each condition you have filters the list of selected objects. 'System: Pick all' resets the filter.
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,000

Post » Sun Feb 24, 2013 6:05 pm

Latest version is up. It seems to sort of be getting there but it goes all screwy.

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

Also of interest, when I did this

"Pick all peg"
"Pick source peg"

it worked

But then followed directly with

"Pick all peg"
"Pick dest peg"

.. dest peg wasn't found, in fact only finds it without "pick all". Can't get my head around that one.
B
20
S
6
G
2
Posts: 157
Reputation: 3,109

Post » Sun Feb 24, 2013 7:13 pm

You can't pick dest peg because it's just been created. When you create an object then it is picked and stays picked in sub-events. But if you unpick then you can't pick it again. And if you use pick all, that will pick all the pegs except for dest peg because it's not yet pickable. I know - it's confusing.

physicsBridge2.capx
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,000

Post » Mon Feb 25, 2013 10:29 am

Ah man, I was so close!

I knew collisions were messing it up, only found out how to turn those off yesterday. Also your ordering makes more sense so I've made very similar changes.

All working, hoorah! Thanks for all your help. :)

The picking still confuses me as I feel it's contradictory. But hopefully it'll click into place the more I work with c2.

I would be interested in making this rope bridge object as a plugin for the community, don't suppose you have any tips on where to start? I've seen the SDK area but could use an example "create a simple object" tutorial and can't find one.

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

Previous

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 25 guests