Picking.. destroying then for each and still found

Bugs will be moved here once resolved.

Post » Tue Jan 07, 2014 5:28 am

Link to .capx file (required!):
http://www.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
B
16
S
5
G
1
Posts: 190
Reputation: 2,489

Post » Tue Jan 07, 2014 1:20 pm

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.
Scirra Founder
B
387
S
230
G
87
Posts: 24,248
Reputation: 192,226

Post » Wed Jan 08, 2014 4:23 am

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 ?Rushino2014-01-08 04:25:02
B
16
S
5
G
1
Posts: 190
Reputation: 2,489


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 1 guest