Пример #1
0
 void input()
 {
     if (Console.KeyAvailable)
     {
         ConsoleKeyInfo key = Console.ReadKey();
         if (key.Key == ConsoleKey.LeftArrow)
         {
             Move(0);
         }
         else if (key.Key == ConsoleKey.RightArrow)
         {
             Move(1);
         }
         else if (key.Key == ConsoleKey.UpArrow && !Collisions.rotateCollisionCheck(currTetromino, board))
         {
             Rotate(1);
             board.DrawBoard();
         }
         else if (key.Key == ConsoleKey.DownArrow && !Collisions.rotateCollisionCheck(currTetromino, board))
         {
             Rotate(0);
             board.DrawBoard();
         }
         else if (key.Key == ConsoleKey.Spacebar && !Collisions.dropCollisionCheck(currTetromino, board))
         {
             Drop();
             board.DrawBoard();
         }
     }
 }
Пример #2
0
 public void Update()
 {
     if (Collisions.dropCollisionCheck(currTetromino, board))
     {
         deltaTime.Reset();
         checkRows();
         GenerateTetrominos();
         Tetromino.Spawn(currTetromino, board);
         deltaTime.Start();
     }
     if (deltaTime.ElapsedMilliseconds > dropRate)
     {
         Drop();
         deltaTime.Restart();
         board.DrawBoard();
     }
 }