Bullet pattern isn't behaving as expected

Posted by Fibericon on Game Development See other posts from Game Development or by Fibericon
Published on 2012-09-20T08:55:54Z Indexed on 2012/09/20 9:52 UTC
Read the original article Hit count: 269

Filed under:

I have a boss that's supposed to continuously shoot five streams of bullets, each at a different angle. It starts off just fine, but doesn't seem to want to use its entire array of bullets. No matter how large I set the length of bulletList, the boss simply stops shooting after a couple of seconds, then pick up again shortly. Here's what I'm using to generate the pattern:

Vector3 direction = new Vector3(0.5f, -1, 0);

for (int r = 0; r < boss.gun.bulletList.Length; r++)
{
   if (!boss.gun.bulletList[r].isActive)
   {
      boss.gun.bulletList[r].direction = direction;
      boss.gun.bulletList[r].speed = boss.gun.BulletSpeedAdjustment;
      boss.gun.bulletList[r].position = boss.position;
      boss.gun.bulletList[r].isActive = true;
      break;
   }

}
direction = new Vector3(-0.5f, -1, 0);
//Repeat with four similar for loops, to place a bullet in each direction

It doesn't seem to matter if the bulletList length is 1000 or 100000. What could be the issue here?

© Game Development or respective owner

Related posts about XNA