Picking.. destroying then for each and still found

0 favourites
  • 3 posts
From the Asset Store
Use this game pack to create your own game, modify the existing game or simply take a look and see how it was made.
  • Link to .capx file (required!):

    mediafire.com/download/c2pva1vo43bxbfh/PickingBugWithFunctions.capx

    Steps to reproduce:

    1. Add event picking all sprite X or for each sprite X in a function that destroy found sprite X. That should destroy all the sprites X.

    2. Add an event after that tell to loop that sprite X with a for each. Normally none should be found since they got destroyed.. but they are still found.

    Observed result:

    Sprites X are still found in the function even if they got destroyed just before. That doesn't happen outside the function.

    Expected result:

    I expected that all the sprite X would have been destroyed and none could be found in the next for each event.

    Browsers affected:

    Node-Toolkit

    Operating system & service pack:

    Windows 7 64 bits, service pack 1

    Construct 2 version:

    r152

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Closing as by design. 'Destroy' does not take immediate effect. This is so that beginner-style events which do things like "Destroy A; create explosion at A.X, A.Y" still work as intended. Objects marked as to be destroyed with the Destroy action are cleaned up either at the end of the tick or at the next top-level event.

  • Alright thanks for clarification. Should it be useful to have a condition to detect that an object has been marked as such ? or does this mechanic already exist ?

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