Using Touch to select the topmost sprite object

Get help using Construct 2

Post » Wed Dec 18, 2013 8:54 am

How do I write the conditions to select only the topmost sprite object when they happen to overlap? My code at the moment is On Touch sprite object destroy. So, when two different moving sprite objects happen to overlap, I only want to select the topmost sprite and destroy it. With my present code, both overlapping sprites are destroyed.
Any help given will be much appreciated.
B
11
S
1
Posts: 11
Reputation: 1,097

Post » Wed Dec 18, 2013 9:28 am

Condition:
-On touch "Object"
--Object pick top most (Under "Z order" category)
Actions:
-Object Destroy
B
17
S
8
G
4
Posts: 93
Reputation: 3,190

Post » Wed Dec 18, 2013 2:55 pm

But it doesn't work when the overlapping sprites are of different objects. The pick top applies to instances of objects, not the top object when the below sprite is of a different object.
B
11
S
1
Posts: 11
Reputation: 1,097

Post » Thu Dec 19, 2013 1:17 am

In that case, create a family (let's call it "destroyableFamily" and include all objects that could be destroyed into this family. And have this instead:

Condition:
-On touch "destroyableFamily"
-- "destroyableFamily" pick top most (Under "Z order" category)
Actions:
- "destroyableFamily" Destroykeroberos2013-12-19 01:29:51
I got a game that you multiply, breath fire with two heads and brawl foes to oblivion with your clones: http://www.newgrounds.com/portal/view/660664 (use Chrome on Windows for best performance)

My sites:
http://twinblazar.deviantart.com
http://twinblazar.newgrounds.com
https://twitter.com/twinblazar
http://www.pixiv.net/member.php?id=15072448
B
30
S
11
G
11
Posts: 411
Reputation: 8,459

Post » Wed Apr 27, 2016 6:22 am

Hi @keroberos

can you help me in same problem? viewtopic.php?f=147&t=171926&p=1032398
B
10
S
3
Posts: 180
Reputation: 1,212

Post » Wed Apr 27, 2016 4:03 pm

I see someone already helped you there. :)
I got a game that you multiply, breath fire with two heads and brawl foes to oblivion with your clones: http://www.newgrounds.com/portal/view/660664 (use Chrome on Windows for best performance)

My sites:
http://twinblazar.deviantart.com
http://twinblazar.newgrounds.com
https://twitter.com/twinblazar
http://www.pixiv.net/member.php?id=15072448
B
30
S
11
G
11
Posts: 411
Reputation: 8,459

Post » Wed Apr 27, 2016 4:05 pm

@keroberos , thank you for reply , yes, my problem has gone! best regards.
B
10
S
3
Posts: 180
Reputation: 1,212


Return to How do I....?

Who is online

Users browsing this forum: plinkie, Syazanie Amirin and 3 guests