예제 #1
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     if (CheckFallingDown())
     {
         figure.FallDown();
     }
     else
     {
         foreach (Point position in figure.GetAbsoluteCoordinates())
         {
             board[position.Y, position.X] = CellState.Filled;
         }
         CheckFullLines();
         ScoreLabel.Text = "Score: " + score;
         figure          = CreateNewFigure(new Point(CellsXMax / 2, 1), nextFigure.type);
         nextFigure      = CreateNewFigure(new Point(1, 1), (FigureType)random.Next(0, 8));
         NextFigurePictureBox.Refresh();
         if (CheckLostGame())
         {
             timer1.Stop();
             MessageBox.Show("You lost! Try Again!");
             Restart();
         }
     }
     BoardPictureBox.Refresh();
 }