I'm trying to make a system where objects that are not near the player are not created until they're needed - my game has a very small visible area around the player, so until enemies are right on top of him they don't need to have lots of extra sprites that are slowing the game down.
The idea I had was to have a Culling sprite around the player, and when it touched an enemy it spawned all the extras (i.e. a shadow), but at the moment it's spawning one shadow per tick, even though I have a "Trigger Once" condition (sometimes? it seems very flaky).
You can see the problem here.
Move with the arrow keys and try overlapping the pink "Culler" over the HTML5 icons, see the Shadow count skyrocket even though there's a Trigger Once condition.
and here's the Capx.
That's not even mentioning trying to delete an object when it's outside of the Culling sprite, which seems to be even more flaky. Am I approaching this problem the wrong way?
EDIT: The reason I ask is because I'm struggling to maintain a decent framerate in the game I'm building, so I need to find all the little ways to make it run as fast as possible. Perhaps I'm trying to do too much with C2, not sure yet. Here's what I have so far: Shadow test for zombie game. I'm getting about 50 fps in IE9 until a flare goes off, then it halves.