Exemple #1
0
        /**
         * this will start the game
         */
        private void startbutton_Click(object sender, EventArgs e)
        {
            game maingame = new game(); //this will launch the game window

            this.Hide();                //this will hide the main menu
            maingame.ShowDialog();      //this will show the game window
            this.Close();               //this will close the main menu
        }
        /**
         * this method will restart the game when it is clicked
         */
        private void restart_button_Click(object sender, EventArgs e)
        {
            game maingame = new game();      //this will open the game window

            this.Hide();                     //this will hide this window
            string nam = name_textBox.Text;  //this will get the name of the player

            highscore.addtolist(nam, Score); //this will add the name and the score to the list if it is on the top 10
            maingame.ShowDialog();           //this will restart the game
            this.Close();
        }