I have around 100 sprite objects for which I'm checking collision against a laser object like
for(int i=1; i<=100; i++)
{
if CGRectIntersectsRect (laser.boundingBox, obj[i].boundingBox);
{
//some stuff here
}
}
My game design is like this that at a given time only three or four objects are present on the screen.
The whole game loop goes like this
1. Obj[1] is created and moved outside the screen bounds then it disappears.
2. Obj[2] is created and the above step is repeated
in short One by One objects are created and then moved outside the screen before I release them.
One drawback I see with this approach is that I'm taking an extra overhead in checking the 100 sprite collisons for only 2-3 objects that are actually present on screen.
Is there any approach that i can use to limit this overhead at run time