Hello,
I stomped on something weird..
I do in a function..
+ Pick All ObjectA.. Destroy..
Then somewhere after i do..
For Each ObjectA.. and it still find something in the loop.. why ?
It is because the object is kept in memory before the next tick ? I expected that the loop find nothing since i ordered to destroy all of them before that event. It seem to happen only in functions.
Here a screen... in a mini sample.
mediafire.com/view/ivqiw8x4yjcc3le/Bug.png
Here a demo..
mediafire.com/download/c2pva1vo43bxbfh/PickingBugWithFunctions.capx
Thanks!
<img src="http://i.imgur.com/aEzqq5a.png" border="0" />
Yeah seem like construct 2 haven't finished destroying them when the for each loop is reach. I have put a wait to fix it.. but is there another way to fix that ? problem with the wait is that its only apply to next action.
Develop games in your browser. Powerful, performant & highly capable.
It's that way on purpose. So that you can still do all the maintenance on the object you destroyed, like access the instance variables, spawn an explosion at one of it's image points, or a variety of other things.
So usually it's a good thing.
Alright. That increase my understanding of Construct 2 at the same time. Hehe. I have been able to avoid using wait.. i just had to put a flag telling the app that in the next tick.. do the rest of the operations. So this enable to destroy in the first set and then do other stuff with the new instances.
Thanks for you guys help.