Ejemplo n.º 1
0
        public Game()
        {
            g_objects = new List <GameObject>();

            isAlive = true;

            snake = new Snake(5, 3, "o", ConsoleColor.Blue);

            food = new Food(0, 0, "O", ConsoleColor.Green);
            food.Generate();

            wall = new Wall("+", ConsoleColor.Gray);
            wall.Walls();

            while (food.IsCollisionWithObject(snake) || food.IsCollisionWithObject(wall))
            {
                food.Generate();
            }

            g_objects.Add(snake);
            g_objects.Add(food);
            g_objects.Add(wall);

            Console.CursorVisible = false;

            Console.SetWindowSize(40, 20);
        }