Exemple #1
0
        public Game(Random random, Rectangle formArea)
        {
            this.formArea = formArea;
            this.random   = random;

            // Se crea un objeto con una Lista de Estrellas con su posición y el color
            stars = new StarMaker(random, formArea);

            // Crea los labels en la posición del rectangulo
            scoreLocation = new PointF((formArea.Left + 5.0F), (formArea.Top + 5.0F));
            livesLocation = new PointF((formArea.Right - 120.0F), (formArea.Top + 5.0F));
            waveLocation  = new PointF((formArea.Left + 5.0F), (formArea.Top + 25.0F));

            // Crea el objeto nave en el punto de la localización del rectangulo
            playerShip = PlayerShip.Instance;
            playerShip.InitValues(formArea,
                                  new Point((formArea.Width / 2), (formArea.Height - 50)));

            // Creación de las listas
            playerShots  = new List <Shot>();
            invaderShots = new List <Shot>();
            invaders     = new List <Invader>();

            // Siguiente nivel
            nivel = new Level(invaders);
            nivel.nextWave();
            //nextWave();
        }