Problem w/ referencing one of two same objects.

Get help using Construct 2

Post » Sun Jul 28, 2013 1:02 am

I have a situation where I am referencing the same object twice in an event and action (using a family) and I only want to reference a single one of the objects, not all of them

In this case, the code is "If object is overlapping object and object.x is less than object.x"
B
10
S
3
G
3
Posts: 234
Reputation: 3,467

Post » Sun Jul 28, 2013 1:18 am

create a family with only object objects , and do
If object is overlapping family1

B
41
S
17
G
17
Posts: 2,247
Reputation: 17,436

Post » Mon Dec 23, 2013 2:19 pm

But is there a chance to do it without families?
B
7
S
2
Posts: 15
Reputation: 634

Post » Mon Dec 23, 2013 3:13 pm

You could also use 'Pick Nth'. 'Pick instance 0' will pick the first instance involved in the collision, and 'Pick instance 1' will pick the second.
Scirra Founder
B
383
S
224
G
86
Posts: 24,117
Reputation: 190,432

Post » Wed Jan 29, 2014 7:52 pm

Can you "Pick Nth" to pick the last instance?

I'm having a similar problem, I'm trying to select a specific overlapping sprite, but it defaults to selecting the sprite with the lowest UID (or appears to), while I want the one with the highest UID. If I use "Pick Nth" with N = 0, I get the card with lowest UID, N=1 gives me the card with 2nd lowest UID etc... but I want the card with the highest UID, and the number of cards picked isn't set.
B
11
S
3
G
1
Posts: 98
Reputation: 1,062

Post » Thu Jan 30, 2014 12:10 am

@Robsta Do N=Object.PickedCount - 1
B
46
S
14
G
7
Posts: 603
Reputation: 8,096

Post » Thu Jan 30, 2014 2:40 pm

Works great, thanks
B
11
S
3
G
1
Posts: 98
Reputation: 1,062


Return to How do I....?

Who is online

Users browsing this forum: ColombageEnPLS, gianghl1983 and 11 guests