}//end throwButton

        private void timer1_Tick(object sender, EventArgs e)
        {
            Two_Up_Game.IncrementCounter();
            bool heads   = true;
            bool tails   = false;
            int  counter = Two_Up_Game.GetCounter();

            if ((counter == 1) || (counter == 3) || (counter == 5) || (counter == 7) || (counter == 9))
            {
                UpdatePictureBoxImage(pictureBox1, heads);
                UpdatePictureBoxImage(pictureBox2, heads);
            }
            else if ((counter == 2) || (counter == 4) || (counter == 6) || (counter == 8))
            {
                UpdatePictureBoxImage(pictureBox1, tails);
                UpdatePictureBoxImage(pictureBox2, tails);
            }
            else
            {
                timer1.Stop();
                Two_Up_Game.TossCoins();                                         //tosses the coins
                UpdateImage();                                                   //updates the images with correct images
                label1.Text        = Two_Up_Game.TossOutcome();                  //updates label1 with the outcome of the toss
                label1.Visible     = true;                                       //makes label1 visible
                label3.Text        = Two_Up_Game.GetPlayersScore().ToString();   //updates player's score when outcome is heads
                label5.Text        = Two_Up_Game.GetComputersScore().ToString(); //updates computer's score when outcome is tails
                playButton.Visible = true;                                       //makes 'play' button visible
            }
        }
Пример #2
0
        }// end UpdatePictureBoxImage

        // A throw button will be implemented where a timer will start (where multiple coins faces
        // will be seen before the outcome happens)

        private void throwButton_Click(object sender, EventArgs e)
        {
            counter = 0;

            timer1.Start();

            if (Two_Up_Game.TossOutcome() == "Heads" ||
                Two_Up_Game.TossOutcome() == "Tails")
            {
                throwButton.Enabled = false;
                againButton.Visible = true;
            }
        }
Пример #3
0
 /// <summary>
 /// creates the delay for the coin flip animation
 /// calls toss coin funcation
 /// </summary>
 private void timer1_Tick(object sender, EventArgs e)
 {
     UpdatePictureBoxImage(pictureBox1, temp);
     UpdatePictureBoxImage(pictureBox2, !temp);
     temp = !temp;
     if (timerClickCounter == 10)
     {
         Two_Up_Game.TossCoins();
         label1.Text = Two_Up_Game.TossOutcome();
         UpdateScores();
         UpdateImages();
         timer1.Stop();
     }
     else
     {
         timerClickCounter++;
         label1.Visible = true;
     }
 }
Пример #4
0
        // a timer click will be implemented, where during the throw button, the coin will
        // siphon through either heads or tails until after a certain time, it will then land and choose
        // either heads or tails

        private void timer1_Tick(object sender, EventArgs e)
        {
            counter += 1;
            Two_Up_Game.TossCoin();
            UpdatePictureBoxImage(pictureBox1, Two_Up_Game.IsHeads(0));
            UpdatePictureBoxImage(pictureBox2, Two_Up_Game.IsHeads(1));
            label5.Visible      = true;
            label5.Text         = Two_Up_Game.TossOutcome();
            throwButton.Enabled = false;
            if (counter == 10)
            {
                timer1.Stop();
                if (Two_Up_Game.TossOutcome() == "Odd")
                {
                    throwButton.Enabled = true;
                }
                playernumberLabel.Text   = Convert.ToString(Two_Up_Game.GetPlayersScore());
                computernumberLabel.Text = Convert.ToString(Two_Up_Game.GetComputersScore());
            }
        }