Пример #1
0
        static void playGame()
        {
            while (!gameOver)
            {
                if (direction == 1)
                {
                    snake.Move(-1, 0);
                }
                if (direction == 2)
                {
                    snake.Move(1, 0);
                }
                if (direction == 3)
                {
                    snake.Move(0, -1);
                }
                if (direction == 4)
                {
                    snake.Move(0, 1);
                }
                if (snake.cnt == 60)
                {
                    wall = new Wall(2);
                    Console.Clear();
                }
                if (snake.CollisionWallandSnake(wall.body))
                {
                    Console.Clear();
                    gameOver = true;
                }


                snake.Draw();
                wall.Draw();
                Thread.Sleep(speed);
            }
        }