This is really start to eat me. So, I`m making an arcade/shooter game, inspired by Asterax, if anyone still remembers the old Mac game. The game is level based and you have to shoot asteroids with your space ship. every next level increases the asteroid count by one, starting at 3, so at level 10 you would have 13 asteroids. Now, not minding the graphics rendering lag, i really feel like my code should be optimized, as at level 15 the cpu seems to be at full usage.
As it is now, I have a for… in loop on every shot and the ship, that checks the distance to every single asteroid on the field, every frame. I know, very bad programming. What I had in mind was putting a single loop on _root to check all objects for collision (checking the distance seems to be easier on the cpu then the flash
s hitTest function), that would probably work better, but at level 30 it would prolly be the same.
Is there any other way?
Thanks in advance, Sigfa.