How do I destroy on pinned objects destruction?

  • Hello,

    I am looking to destroy particles when the sprite they are pinned to is destroyed.

    I understand I can do it with a container, but the particles are added after the sprite is created. Thus, if I put them in a container it creates a 2nd sprite.

    Is there any event or event combination that is essentially:

    particle is pinned to object +

    object is destroyed

    =

    Destroy particle

  • Use a pair ID. Give them both an instance variable named "Pair_ID." Each sprite will have a different pair_id number. When the particles are created, set their pair_id to the sprite that they were created for's pair_id. Then, when the sprite is destroyed, make it so if particles have the same pair_id as the sprite, destroy them as well. Using this you can also do more sprites or particles in the same pair_id.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I would use the parent objects "on destroyed" condition in combination with the particles pin condition "is pinned", and the "pick nearest" to parent xy.

  • Thank you both for replying.

    I went with the comparing UID, it made more sense to me.

    :)

  • No problem. It actually does not use UIDs (Unique Identification) It uses Pair_ID variable there is a difference.

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