private void tmrPiece_Tick(object sender, EventArgs e) { TimeSpan timer = DateTime.Now.Subtract(startTime); // Move the piece down tmrPiece.Interval = 120 - (tb.CheckLevel() - 1) * 10; tb.Update(); // Update level, lines cleared, score and timer lblLevel.Text = "LEVEL\n" + Convert.ToString(tb.CheckLevel()); lblLines.Text = "LINES\n" + Convert.ToString(tb.CheckLines()); lblScore.Text = "SCORE\n" + Convert.ToString(tb.CheckScore()); lblTimer.Text = string.Format("{0}:{1:00}", timer.Minutes, timer.Seconds); // If game is over if (tb.GameOver()) { // Stop timers tmrPiece.Stop(); tmrMusic.Stop(); // Stop music, hide and close current form, open end form mp.Stop(); this.Hide(); this.Close(); FrmEnd myGame = new FrmEnd(tb.CheckScore()); myGame.ShowDialog(); } // Check for line clears and play sound effect once if (tb.PlayEffect() == true) { sndClear.Play(); tb.StopEffect(); } // Redraw the game this.Invalidate(); }