Exemplo n.º 1
0
        }//end initializeGame

        public void nextLevel()
        {
            GameSetup gameSetup = new GameSetup(PlayArea);

            if (playerLives <= 3)
            {
                ++playerLives;
                lblLives.Content = "Lives:   " + playerLives;
            }

            this.fireRate -= 200;
            this.aliens    = gameSetup.createAliens();
        }
Exemplo n.º 2
0
        }//end GamePlay

        public void initiaizeGame()
        {
            PlayArea.Children.Clear();

            this.playerLives = INITIAL_PLAYER_LIVES;

            GameSetup gameSetup = new GameSetup(PlayArea);

            this.lblScore = new Label {
                Content    = "Score:   " + scoreVal,
                Width      = 500,
                Height     = 30,
                FontSize   = 16,
                FontWeight = FontWeights.Bold,
                Foreground = Brushes.LimeGreen,
                Margin     = new Thickness(0, 0, 60, 30),
            };

            this.lblLives = new Label
            {
                Content    = "Lives:   " + playerLives,
                Width      = 100,
                Height     = 30,
                FontSize   = 16,
                FontWeight = FontWeights.Bold,
                Foreground = Brushes.LimeGreen,
                Margin     = new Thickness(PlayArea.Width - 160, 0, PlayArea.Width - 110, 30)
            };

            this.lblLevel = new Label
            {
                Content    = "Level:   " + level,
                Width      = 100,
                Height     = 30,
                FontSize   = 16,
                FontWeight = FontWeights.Bold,
                Foreground = Brushes.LimeGreen,
                Margin     = new Thickness(PlayArea.Width / 2 - 50, 0, PlayArea.Width / 2 + 50, 30),
            };

            PlayArea.Children.Add(lblScore);
            PlayArea.Children.Add(lblLives);
            PlayArea.Children.Add(lblLevel);

            this.segments = gameSetup.buildShields();
            this.aliens   = gameSetup.createAliens();
            this.player   = new Player(PlayArea);
        }//end initializeGame