[SOLVED] Destroy only one overlapping object on click?

Get help using Construct 2

Post » Fri May 22, 2015 8:36 pm

For example: there are 2 overlapping objects of the same type, when I use the "on object clicked" function and set it to destroy the object, both of them are destroyed.

Is there a condition that guarantees that only one will be destroyed ? ( I tried using the "for each" but it didn't work.. )
Last edited by illugion on Fri May 22, 2015 9:09 pm, edited 1 time in total.
B
7
S
1
Posts: 11
Reputation: 447

Post » Fri May 22, 2015 8:47 pm

Systyem:Pick Nth instance, or Pick random instance.
ImageImageImage
B
71
S
21
G
232
Posts: 3,695
Reputation: 129,866

Post » Fri May 22, 2015 8:54 pm

Thank you so much ! It works !!
Just one more thing.. If i wanted to pick the top one ( from the z ordering ) how should I do it ? The "pick nth instance" seems to pick the one that was first created
B
7
S
1
Posts: 11
Reputation: 447

Post » Fri May 22, 2015 9:01 pm

Foreach orderby Sprite.Zindex descending ->Destroy, followed by: Stop loop
ImageImageImage
B
71
S
21
G
232
Posts: 3,695
Reputation: 129,866

Post » Fri May 22, 2015 9:08 pm

Yes !! That's perfect, thanks a lot !!!
B
7
S
1
Posts: 11
Reputation: 447


Return to How do I....?

Who is online

Users browsing this forum: jorgmaquoi and 61 guests