Destroy pinned sprites

Get help using Construct 2

Post » Wed Oct 23, 2013 12:03 am

Hello,

I have the event and action below:

spriteShot On Colision with spritePlane -> spritePlane Destroy.

Is there anyway to put in the action above a way to destroy not only the spritePlane, but too all the sprites that is pinned to this spritePlane ?

thanks,

   Jos Roberto.
B
4
Posts: 26
Reputation: 277

Post » Wed Oct 23, 2013 12:53 am

Have a look at Containers
I think that is what you are looking for.
B
20
S
6
G
4
Posts: 347
Reputation: 4,451

Post » Wed Oct 23, 2013 4:48 am

In case you have a situation where you can't use containers: If the objects pinned to the thing are all of the same type or are in one family, you could do as a subevent to your collision event:

System -> Pick by evaluate -> Object: Object that is pinned to spritePlane -> Expression: Object.Pin.PinnedUID = spriteShot.UID

That should pick all the things of that Object type that are pinned to the sprite you collided with. If you have multiple object types pinned, then it gets a bit messy, as you'd have to do a different pick for each Object type or stick them in a family.

Just make sure to Destroy spriteShot on a subevent after you do all the picking.

EDIT: Here's a .capx illustrating this ideaWertle2013-10-23 05:20:03
B
11
S
2
Posts: 87
Reputation: 1,112

Post » Tue Aug 08, 2017 3:55 pm

@Wertle: Thank you! Save lots of my effort on destroy text pinned to a block.
B
24
S
3
G
1
Posts: 27
Reputation: 1,574


Return to How do I....?

Who is online

Users browsing this forum: David181, OBLIVION and 60 guests