コード例 #1
0
ファイル: Game.cs プロジェクト: Fibonacci66/snake
        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
ファイル: Game.cs プロジェクト: Fibonacci66/snake
        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");
        }