예제 #1
0
        static void Main()
        {
            Console.WriteLine("Выберете сложность игры: 1 - легко, 2 - средне, 3 - сложно");
            int n = 0;
            n = Convert.ToInt32(Console.ReadLine());
            Console.Clear();
            if (n == 1)
            {
                int x1 = 10;
                int y1 = 10;
                walls = new Walls(x1, y1, '0');
                snake = new Snake(x1 / 2, y1 / 2, 3);
                food = new Food(x1, y1, '+');
            }
            if (n == 2)
            {
                int x1 = 15;
                int y1 = 15;
                walls = new Walls(x1, y1, '0');
                snake = new Snake(x1 / 2, y1 / 2, 3);

                food = new Food(x1, y1, '+');
            }
            if (n == 3)
            {
                int x1 = 20;
                int y1 = 20;
                walls = new Walls(x1, y1, '0');
                snake = new Snake(x1 / 2, y1 / 2, 3);
                food = new Food(x1, y1, '+');

            }
            Console.SetWindowSize(x + 1, y + 1);
            Console.SetBufferSize(x + 1, y + 1);
            Console.CursorVisible = false;
            food.CreateFood();

            switch (n)
            {
                case 1:
                    {
                        time = new Timer(Move, null, 0, 400);
                        break;
                    }
                case 2:
                    {
                        time = new Timer(Move, null, 0, 300);

                        break;
                    }
                case 3:
                    {
                        time = new Timer(Move, null, 0, 200);

                        break;
                    }
            }
            while (true)
            {
                if (Console.KeyAvailable)
                {
                    ConsoleKeyInfo key = Console.ReadKey();
                    snake.Rotation(key.Key);
                }
            }
        }