I've found what could be a little bug, or maybe it's just me who doesn't do it right (I'm new to Construct), so I preferred asking for help before
At first there are 1250 "Sprite" objects on my layout. I want to remove them so there are only 800 "Sprite". I know there are hundreds of methods to do so, but I tried using this code :
Sprite2 : Set 'OBJ' to Sprite 0 .Count
Sprite2 : Value 'OBJ' Greater or equal 800
Sprite: Pick one at random
Sprite2 : Subtract 1 from 'OBJ'
Sprite : Destroy[/code:2nxww7id]
So it removes one "Sprite" at each tick until the number reached 800. But in order to remove all of them at once, I've added a "While" condition so they could be destroyed more quickly. This is what this cap does : http://www.zoglu.net/trucs/bugwhile.rar
However, when I run it in the end there are about 860 sprites, while the "Sprite2"'s variable 'OBJ' has reached 800. Like if sometimes the variable was decremented but no "Sprite" was destroyed.
Also, if I try to replace the "Sprite2 : Subtract 1 from 'OBJ'" by a "Sprite2 : Set 'OBJ' to Sprite.Count", it goes into an infinite loop. That's weird, because one "Sprite" is supposed to be destroyed at each loop, so the object count should decrease.
So... I know I'm not following the best way to do it, but it definitely looks like a bug. Or maybe I'm just doing it wrong from the beginning. What do you think about this?