private static void KeyInputCheck(TetrisBlock activeBlock, PlayField playField) { string pauseText = @" ___ | ___ | ___ | ___ | ___ /\--\ | /\--\ | /\__\ | /\--\ | /\--\ /##\--\ | /##\--\ | /#/--/ | /##\--\ | /##\--\ /#/\#\--\ | /#/\#\--\ | /#/--/ | /#/\#\--\ | /#/\#\--\ /##\-\#\--\ | /##\-\#\--\ | /#/--/ ___ | _\#\-\#\--\ | /##\-\#\--\ /#/\#\-\#\__\| /#/\#\-\#\__\| /#/__/ /\__\| /\-\#\-\#\__\| /#/\#\-\#\__\ \/__\#\/#/--/| \/__\#\/#/--/| \#\--\ /#/--/| \#\-\#\-\/__/| \#\-\#\-\/__/ \##/--/ | \##/--/ | \#\--/#/--/ | \#\-\#\__\ | \#\-\#\__\ \/__/ | /#/--/ | \#\/#/--/ | \#\/#/--/ | \#\-\/__/ | /#/--/ | \##/--/ | \##/--/ | \#\__\ | \/__/ | \/__/ | \/__/ | \/__/ "; if (KeyAvailable) { ConsoleKeyInfo key = ReadKey(); if (key.Key == ConsoleKey.Escape) { isPlaying = false; } if (key.Key == ConsoleKey.Enter && pauseMenu == false) { Engine.ClearScreen(); Engine.DrawTitle(pauseText, 10); pauseMenu = true; ReadKey(); } if (key.Key == ConsoleKey.Enter && pauseMenu == true) { Engine.ClearScreen(); pauseMenu = false; } if (key.Key == ConsoleKey.RightArrow) { if ((activeBlock.XPos < playField.XWith - (activeBlock.Shape.GetLength(1) + 1))) { activeBlock.XPos += 2; if (playField.CollisionCheck(activeBlock)) { activeBlock.XPos -= 2; } } } if (key.Key == ConsoleKey.LeftArrow) { if (activeBlock.XPos >= 1) { activeBlock.XPos -= 2; if (playField.CollisionCheck(activeBlock)) { activeBlock.XPos += 2; } } } if (key.Key == ConsoleKey.UpArrow) { activeBlock.RotateShape(); } if (key.Key == ConsoleKey.DownArrow) { tick = 1; activeBlock.YPos++; } if (key.Key == ConsoleKey.Spacebar) { while (!playField.CollisionCheck(activeBlock)) { activeBlock.YPos++; Hud.Score++; } playField.UpdateField(activeBlock); playField.ScoreCheck(); // game over if (playField.CollisionCheck(activeBlock)) { HighScores.CheckHighScore(Hud.Score); isPlaying = false; } } } }