private void ShootBullet() { if (mCurrentState == State.Walking) { bool aCreateNew = true; for (int i = 0; i < mBullets.Count; i++) { if (mBullets[i].Position.Y < 0) { mBullets.RemoveAt(i); } } if (aCreateNew == true) { Bullet aBullet = new Bullet(); aBullet.LoadContent(mContentManager); aBullet.Fire(Position + new Vector2((FrameSize / 2 - aBullet.Size.Width / 2) + (bulletFlip * 12), 12), new Vector2(200, 200), new Vector2(0, -1)); mBullets.Add(aBullet); bulletFlip *= -1; } } }
private void ShootBullet(Enemy enemy) { for (int i = 0; i < mBullets.Count; i++) { if (mBullets[i].Position.Y > graphicsDevice.Viewport.Height) { mBullets.RemoveAt(i); } } Bullet aBullet = new Bullet("laser"); aBullet.LoadContent(mContentManager); aBullet.Fire(enemy.Position - new Vector2((enemy.FrameSize / 2 - aBullet.Size.Width / 2), 12), new Vector2(200, 200), new Vector2(0, 1)); mBullets.Add(aBullet); }