Пример #1
0
        public void Init()
        {
            WindowWidth  = 70;
            WindowHeight = 35;

            Console.SetWindowSize(WindowWidth, WindowHeight);
            Console.BufferHeight = WindowHeight;
            Console.BufferWidth  = WindowWidth;
            Console.Title        = "Worm";
            Console.Clear();


            // Rita upp låda
            Width  = 30;
            Height = 25;
            Console.BackgroundColor = ConsoleColor.Blue;

            for (var i = 0; i < Width; i++)
            {
                Console.SetCursorPosition(i, Height);
                Console.WriteLine(" ");
                Console.SetCursorPosition(i, 0);
                Console.WriteLine(" ");
            }
            for (var i = 0; i <= Height; i++)
            {
                Console.SetCursorPosition(Width, i);
                Console.WriteLine(" ");
                Console.SetCursorPosition(0, i);
                Console.WriteLine(" ");
            }
            Console.ResetColor();

            Score = 0;

            UpdateScore();
            UpdateHighscore();
            worm = new Worm(this);

            food = new Food(this);

            PressEnter("Tryck enter för att starta");
        }
Пример #2
0
        public void Init()
        {
            WindowWidth = 70;
            WindowHeight = 35;

            Console.SetWindowSize(WindowWidth, WindowHeight);
            Console.BufferHeight = WindowHeight;
            Console.BufferWidth = WindowWidth;
            Console.Title = "Worm";
            Console.Clear();

            // Rita upp låda
            Width = 30;
            Height = 25;
            Console.BackgroundColor = ConsoleColor.Blue;

            for (var i = 0; i < Width; i++ )
            {
                Console.SetCursorPosition(i, Height);
                Console.WriteLine(" ");
                Console.SetCursorPosition(i, 0);
                Console.WriteLine(" ");
            }
            for (var i = 0; i <= Height; i++)
            {
                Console.SetCursorPosition(Width, i);
                Console.WriteLine(" ");
                Console.SetCursorPosition(0, i);
                Console.WriteLine(" ");
            }
            Console.ResetColor();

            Score = 0;

            UpdateScore();
            UpdateHighscore();
            worm = new Worm(this);

            food = new Food(this);

            PressEnter("Tryck enter för att starta");
        }