How do I pick last destroyed instance?

0 favourites
  • 8 posts
From the Asset Store
Pick Up Items Sound effects for your game, Take them for a ride right now and you will worry no more.
  • Is there a way to pick the last destroyed instance of an object? For example, in one tick I destroy several instances and I need to pick the instance that was destroyed last.

    Is there any equivalent to "System > Pick last created", only for destroyed objects?

    Tagged:

  • Unless I'm missing something, I can't see how it would be possible to pick something that's just been destroyed.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The "Destroy" action it is just a request to destroy the object. The object becomes destroyed only after the event sheet processing is finished (only on the next tick).

    For example, if you destroy objects, the "Object Count" expression will still consider the objects existing until the end of the current tick.

  • I need a trigger that allows picking the last destroyed instance of an object. There's an option where upon destroying an object, the expression "Sprite.Count = 1" is checked. However, there might be a situation where several objects are destroyed in one tick. In that case, the On destroyed event with the expression "Sprite.Count = 1" won't trigger.

  • Is there a way to pick the last destroyed instance of an object? For example, in one tick I destroy several instances and I need to pick the instance that was destroyed last.

    Is there any equivalent to "System > Pick last created", only for destroyed objects?

    Hi.

    You can destroy in an enumeration loop. Then the last one will name the smallest IID or the largest depending on the loop settings.

  • One idea will be to keep track manually.

    Here is one example:

    It will Pick and destroy all the black sprites and show who was the last one destroyed.

    dropbox.com/scl/fi/c3tp5wgwqhlmqpgst6fns/Pick-Last-Destroyed1.c3p

  • One idea will be to keep track manually.

    Here is one example:

    It will Pick and destroy all the black sprites and show who was the last one destroyed.

    https://www.dropbox.com/scl/fi/c3tp5wgwqhlmqpgst6fns/Pick-Last-Destroyed1.c3p?rlkey=3cklxpd1fmm8kww7icj6ntnng&dl=0

    Thanks! It seems like using a global variable is the only working way to pick the last destroyed object.

  • > Is there a way to pick the last destroyed instance of an object? For example, in one tick I destroy several instances and I need to pick the instance that was destroyed last.

    >

    > Is there any equivalent to "System > Pick last created", only for destroyed objects?

    Hi.

    You can destroy in an enumeration loop. Then the last one will name the smallest IID or the largest depending on the loop settings.

    Thank you!

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