Destroy all overlapping objects but one

Get help using Construct 2

Post » Sat Jul 20, 2013 8:05 pm

Hello everybody ,

I'm currently searching on a compact way to *insert-title-here*

I have an object , and multiple instances of that object overlapping each others , how would I go about destroying all the overlapping instances but one ?

Thanks for reading and have a nice day !
B
38
S
16
G
17
Posts: 2,230
Reputation: 17,220

Post » Sat Jul 20, 2013 8:19 pm

>Sprite: Is overlapping Sprite
>>Sprite: (invert) Is "Boolean name" - > sprite destroy

Sprite with boolean set to false will be destroyedshinkan2013-07-20 20:20:30
ImageImageImageImage
B
155
S
61
G
41
Posts: 2,577
Reputation: 34,314

Post » Sat Jul 20, 2013 8:31 pm

@shinkan , your script isn't full , isn't it ?

You didn't set the boolean
B
38
S
16
G
17
Posts: 2,230
Reputation: 17,220

Post » Sat Jul 20, 2013 8:34 pm

you could invert a condition that normally picks one

like

+sprite | is overlapping sprite
+sprite | (invert) pick top instance           >sprite | destroy
B
28
S
8
G
1
Posts: 469
Reputation: 4,683

Post » Sat Jul 20, 2013 8:37 pm

You can't reveal all Your secrets. Must leave something to discover by others.
ImageImageImageImage
B
155
S
61
G
41
Posts: 2,577
Reputation: 34,314

Post » Sat Jul 20, 2013 8:44 pm

[QUOTE=keepee] you could invert a condition that normally picks one

like

+sprite | is overlapping sprite
+sprite | (invert) pick top instance           >sprite | destroy[/QUOTE]

@keepee ,

No , I don't think I'll work as intended , but I'll try it anyways !

My idea ,

- Pick all
-- (Invert) Pick instance 0
--- Destroy
B
38
S
16
G
17
Posts: 2,230
Reputation: 17,220

Post » Sat Jul 20, 2013 8:46 pm

Is there a specific instance you want to keep, or just random one?
ImageImageImageImage
B
155
S
61
G
41
Posts: 2,577
Reputation: 34,314

Post » Sat Jul 20, 2013 8:47 pm

@shinkan , just a random one
B
38
S
16
G
17
Posts: 2,230
Reputation: 17,220

Post » Sat Jul 20, 2013 8:50 pm

To be honest , and if possible , I'm looking for a techique that doesn't involve variable usage
B
38
S
16
G
17
Posts: 2,230
Reputation: 17,220

Post » Sat Jul 20, 2013 11:27 pm

@Whiteclaws

sorry, should have tested what I wrote before sending it.

"doesn't involve variable usage"

not even a non-static local variable?

you could store the UID of one of the objects overlapping and then invert a 'pick by UID' condition. Inverted pick by UID works, i've used it a few times.
B
28
S
8
G
1
Posts: 469
Reputation: 4,683

Next

Return to How do I....?

Who is online

Users browsing this forum: MAVERICK, oosyrag and 8 guests