private void BtnHard_Click(object sender, EventArgs e)
        {     // If the user clicks on the hard difficulty button
            if (UsernameValid == 0)
            { // If the user name is valid
                // Show the countdown to the game starts
                LblToStart.Visible   = true;
                LblGameStart.Visible = true;

                // Display the sidebar elements such as lives textbox, lives label, etc
                LvlCount.Visible      = true;
                LvlTxt.Visible        = true;
                ScoreCount.Visible    = true;
                ScoreTxt.Visible      = true;
                label1.Visible        = true;
                LvsCount.Visible      = true;
                LvsTxt.Visible        = true;
                LevelProgress.Visible = true;
                LblName.Visible       = true;

                // Hide the welcome to game message, username, instructions
                LblInstructions.Visible = false;
                TbUsername.Visible      = false;
                LblWelcome.Visible      = false;
                LblUsername.Visible     = false;

                // Hide the difficulty buttons
                BtnHard.Visible   = false;
                BtnMedium.Visible = false;
                BtnEasy.Visible   = false;

                // Disable the difficulty buttons to allow the surfer to move
                BtnHard.Enabled   = false;
                BtnMedium.Enabled = false;
                BtnEasy.Enabled   = false;

                // Disable the timers
                TmrShark.Enabled       = false;
                TmrSurfer.Enabled      = false;
                BottleTimer.Enabled    = false;
                BottleTimeWait.Enabled = false;

                lives       = 1;                             // Set the lives count to 1
                LvsTxt.Text = lives.ToString();              // Display the lives count in the LvsText textbox

                TmrCountdown.Start();                        // Start the countdown timer

                LblName.Text = "Welcome " + TbUsername.Text; // Edit the text to say Welcome then their name

                TmrPopUp.Start();
                LblPopUp.Visible = true; // Display the popup text
                LblPopUp.Text    = "Hard difficulty selected";
            }
        }
示例#2
0
 private void MnuStart_Click(object sender, EventArgs e)
 {
     score = 0;
     TmrAlien.Start(); //start the timer
     TmrCountdown.Start();
 }