Exemple #1
0
 private static void GameOver()
 {
     inGame = false;
     Console.SetCursorPosition(35, 13);
     Console.ForegroundColor = ConsoleColor.Red;
     Console.WriteLine("GAME OVER!");
     Console.ForegroundColor = ConsoleColor.White;
     Console.ReadKey();
     Snake.ClearSnake();
     CheckResultInHallOfFame();
     Menu.RunMenu();
 }
Exemple #2
0
 public static void GameOver()
 {
     inGame = false;
     Console.SetCursorPosition(35, 13);
     Console.ForegroundColor = ConsoleColor.Red;
     Console.WriteLine("GAME OVER!");
     Console.ForegroundColor = ConsoleColor.White;
     Console.ReadKey();
     Snake.ClearSnake();
     Console.Clear();
     //CheckResultRecords();
     //Menu.Draw();
 }
Exemple #3
0
 private void GameOver()
 {
     if (_lives > 0)
     {
         Console.SetCursorPosition((Console.WindowWidth - 20) / 2, Console.WindowHeight / 2);
         Console.WriteLine("You lost. Press to continue");
         Console.ReadKey();
         _lives--;
         Console.Clear();
         _snake.ClearSnake();
         NewGame();
     }
     else
     {
         _play = false;
         Console.ForegroundColor = ConsoleColor.Red;
         var str = "GAME OVER";
         Console.SetCursorPosition((Console.WindowWidth - str.Length) / 2, Console.WindowHeight / 2);
         Console.WriteLine(str);
         Console.ResetColor();
         BestResult.WriteResult(_score);
     }
 }
Exemple #4
0
        private static void IsFoodEaten()
        {
            if (Snake.CheckColission(food.X, food.Y))
            {
                if (food.View == 0)
                {
                    Snake.ClearSnake();
                    Snake.Make();
                }
                else
                {
                    score += food.View;
                    Snake.Grow();
                    Console.SetCursorPosition(1, 24);
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.Write("Score = {0}", score);
                    Console.ForegroundColor = ConsoleColor.White;
                }

                food = new Food();
                food.Appear();
            }
        }