[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
9
S
2
Posts: 13
Reputation: 601

Post » Fri May 22, 2015 8:47 pm

Systyem:Pick Nth instance, or Pick random instance.
ImageImageImage
B
71
S
22
G
259
Posts: 3,793
Reputation: 143,702

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
9
S
2
Posts: 13
Reputation: 601

Post » Fri May 22, 2015 9:01 pm

Foreach orderby Sprite.Zindex descending ->Destroy, followed by: Stop loop
ImageImageImage
B
71
S
22
G
259
Posts: 3,793
Reputation: 143,702

Post » Fri May 22, 2015 9:08 pm

Yes !! That's perfect, thanks a lot !!!
B
9
S
2
Posts: 13
Reputation: 601


Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider], max2612 and 23 guests