Hiya, so I've been using Dark Basic for a while ( I just switched to DarkGDK ), and I got to the stage in my game where I apply physics and crap to all of the spaceships, and handle all of the bullets, etc.
I was wondering if there was a more efficient way to do this, other than using a for loop. Right now i have something like this
void Update_Lasers ( void )
{
for ( int i = 0; i < NumBullets; i++ )
{
Bullet[i].Pos.ApplyMovement
Bullet[i].CheckCollisions
Bullet[i].DecreaseLife
Blah blah blah
}
}
I am wondering if there is a better way to do this? This is the way I've always done it, but I can't believe that big games like FEAR or something just use a for loop to run through all the AI, etc.
Is there some way to just refer to all the elements in an array without using a for loop?
The problem is that often, bullet[25] or something will hit a wall, and there might be say, 100 bullets active at that moment. This means that the program will still run through 100 loops, even though bullet #25 doesn't need to be controlled. In a more drastic case, say bullets 0 through 99 are dead, but bullet[100] is alive. My loop would still have to run from 0 to 100, which is 99 wasted cycles.
How do you guys handle bullets and AI and things like this?
Thanks