[Resolved] Destroying spawned objects

0 favourites
  • 5 posts
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • During the course of my game, I will have plenty of sprites being spawned on top of other sprites (ie. if you set an enemy on fire, spawn fire sprite. if an enemy detects you, spawn ! sprite). Normally when I destroy a sprite, I can use a "On Sprite1 destroyed - if sprite1 is overlapping sprite2, destroy sprite2" and it works. But what do I do if sometimes multiple instances of Sprite1 will be overlapping each other (which is always a random occurrence)?

    All of the sprites I spawn are pinned 99% of the time. Is there an event to check if an item is pinned to another object? (if I use Sprite2 is Pinned, it destroys ALL of them in the layout)

  • Pin Behavior

    When you destroy an object, check for any other objects who's PinnedUID which match the UID of the sprite being descriptor and destroy those.

  • I'm trying to use it like this:

    On Sprite1 Destroyed

    For Each Sprite1

    Pick Sprite2 Instance with UID "Sprite2.Pin.PinUID"

    -Destroy Sprite2

    It doesn't seem to be working. What am I doing wrong?

  • On Sprite1 Destroyed

    For each Sprite2

    Compare two values: Sprite2.Pin.PinnedUID = Sprite1.UID

    -Destroy Sprite2

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You guys are amazing - thank you!

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