private void MineLabel_Click(object sender, EventArgs e) { // increase counter clickCounter += 1; boxSelected = (Label)sender; // flag for if user hit mine bool hitMine = boxSelected.TabIndex == mineLocation; // user gets winning clicks without hitting mine if (clickCounter == winningClicks && hitMine == false) { boxSelected.BackColor = Color.White; UpdateStats("win"); } // user lands on mine else if (hitMine) { Animate.BlinkMine(boxSelected); UpdateStats("lose"); } // user doesn't land on mine else { boxSelected.BackColor = Color.White; boxSelected.Enabled = false; } }
public void ResetGame() { clickCounter = 0; Animate.BlinkSquares(tableLayoutPanel1); // Generate a random int between 1-20 tand assign to mine variable mineLocation = randomMine.Next(MIN, MAX); }
private void NewGame() { clearStats(); Animate.BlinkSquares(tableLayoutPanel1); // Generate a random int between 1-20 tand assign to mine variable mineLocation = randomMine.Next(MIN, MAX); }