示例#1
0
//Function to re-load the scene if we want to play again.
        public void Run()
        {
            // Get max Width and max height of the Form
            maxWidth  = this.ClientSize.Width;
            maxHeight = this.ClientSize.Height;
            // Make the players
            playerPlane = new PlayerPlane(maxWidth, maxHeight);
            //Make enemy planes and fill the list
            Planes = new List <EnemyPlane>();
            fillList();
            //Make the Boss and his Rocket
            boss        = new Boss(300, 20, this.ClientSize.Width);
            bossRockets = new List <Rocket>();
            //Check if there is a boss on the screen
            BosFight = false;
            // Set the Backgounds [2 Backgrounds repeteng them selfs]
            BG  = new BackGround(-764);
            BG1 = new BackGround(0);
            //Make Clouds on the screen
            clouds = new List <cloud>();
            fillClouds();
            // Set the buffer
            this.DoubleBuffered = true;
            // Set the Blast Image, Scores, Remaining lifes, Time left, and Boss HP bar
            Blast               = false;
            Images              = new BlastImages();
            scoore              = new HighScore();
            ScoreLabel.Text     = string.Format("High Score: {0}", scoore.getScore());
            RemainingLifes.Text = string.Format("Player Lifes: {0}", playerPlane.getPlayerLife());
            TimeLeft            = 180;
            BosLife.Visible     = false;
            BosLife.Value       = boss.getLife();
            //Set the sounds
            sounds = new Sounds();
            sounds.playMainMusic();
            //Get the timers Ready
            GameTimer.Enabled  = true;
            PlayerTime.Enabled = true;
        }
 //Function to re-load the scene if we want to play again.
 public void Run()
 {
     // Get max Width and max height of the Form
             maxWidth = this.ClientSize.Width;
             maxHeight = this.ClientSize.Height;
     // Make the players
             playerPlane = new PlayerPlane(maxWidth, maxHeight);
     //Make enemy planes and fill the list
             Planes = new List<EnemyPlane>();
             fillList();
     //Make the Boss and his Rocket
             boss = new Boss(300, 20, this.ClientSize.Width);
             bossRockets = new List<Rocket>();
     //Check if there is a boss on the screen
             BosFight = false;
     // Set the Backgounds [2 Backgrounds repeteng them selfs]
             BG = new BackGround(-764);
             BG1 = new BackGround(0);
     //Make Clouds on the screen
             clouds = new List<cloud>();
             fillClouds();
     // Set the buffer
             this.DoubleBuffered = true;
     // Set the Blast Image, Scores, Remaining lifes, Time left, and Boss HP bar
             Blast = false;
             Images = new BlastImages();
             scoore = new HighScore();
             ScoreLabel.Text =string.Format("High Score: {0}",scoore.getScore());
             RemainingLifes.Text =string.Format("Player Lifes: {0}",playerPlane.getPlayerLife());
             TimeLeft = 180;
             BosLife.Visible = false;
             BosLife.Value = boss.getLife();
     //Set the sounds
             sounds = new Sounds();
             sounds.playMainMusic();
     //Get the timers Ready
             GameTimer.Enabled = true;
             PlayerTime.Enabled = true;
 }