}//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 } }
/// <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; } }