How do I destroy only an instance of a pinned sprite, instead of all of them?

0 favourites
  • 4 posts
From the Asset Store
Pin UI
$2.49 USD
Create a perfectly Pinned Interface for Any Device
  • Hi!

    I'm making a game where I got some balloons, I want to pin a line sprite to each one of them and destroy that particular line when the balloon is destroyed.

    But when I destroy a single balloon, all the other line sprites are destroyed too.

    Can I destroy only the one that is pinned to that balloon?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You just need to relate the pinned sprite to the balloon somehow. If you put the balloon and pinned sprite in a 'container', then when you use destroy balloon it would destroy the related pinned sprite that was created with it.

    You could also use something like on balloon destroyed, pick pinned sprite overlapping or nearest to the balloon and destroy it. Container gives you more control though and avoids using an overlap check as they are already linked.

  • If you put the balloon and pinned sprite in a 'container', then when you use destroy balloon it would destroy the related pinned sprite that was created with it.

    THANK YOU, lionz! This worked perfectly.

    > You could also use something like on balloon destroyed, pick pinned sprite overlapping or nearest to the balloon and destroy it.

    I don't think I'll need this for this project, but I'm curious, how can I do that?

  • If you select balloon object there is a condition 'on destroyed' which triggers when the object is destroyed. You select the pinned object and there is another condition 'pick nearest', you can combine this with the destroyed condition, pick nearest pinned object to balloon.x,balloon.y (balloon is already picked by destroyed condition)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)