Ejemplo n.º 1
0
        static void Loop(object obj)
        {
            if (walls.IsHit(snake.GetHead()) || snake.IsHit(snake.GetHead()))
            {
                time.Change(0, Timeout.Infinite);
                Console.SetCursorPosition(X / 2, Y / 2);

                Console.Write("Game over");
            }
            else if (snake.Eat(foodFactory.food))
            {
                foodFactory.CreateFood();
            }
            else
            {
                snake.Move();
            }
            Console.SetCursorPosition(1, 30);
            Console.Write(snake.score);
        }