Ejemplo n.º 1
0
        private void UpdateEnemies()
        {
            //destructibleObjects.UpdateAll(gameSpeed);
            for (int i = 0; i < EnemyShips.Count; i++)
            {
                EnemyShip curEnemy = EnemyShips.Dequeue();
                curEnemy.Update(delta);
                curEnemy.fire(Bullets, bulletTextures, r);

                bool myShipIsHit = curEnemy.Intersects(Ship.Bounds); // Should this be here??
                if (myShipIsHit)
                {
                    Ship.Health -= 10 * ((int)(curEnemy.CurSpeed.Y) / 4); // Customize depending on stuff? (type of ship?)
                    if (Ship.Health <= 0)
                    {
                        gameOver = true;
                    }
                }

                bool onScreen = !(curEnemy.Position.Y > MaxY) && !myShipIsHit;
                if (onScreen) // If the Enemy is not past the bottom of the screen
                {
                    EnemyShips.Enqueue(curEnemy);
                }
            }
        }