示例#1
0
        static void Main(string[] args)
        {
            rating = GetRating();

            MainMenu();

            DataSave data = DataGet();

            Game.Set(data);

            Console.CursorVisible = false;
            Console.SetWindowSize(70, 20);

            Thread t = new Thread(Move);

            t.Start();

            while (!Game.Gameover)
            {
                if (Game.Gameover == true)
                {
                    break;
                }
                ConsoleKeyInfo btn = Console.ReadKey();
                if (btn.Key == ConsoleKey.RightArrow && Game.snake.dir != 3)
                {
                    Game.snake.dir = 1;
                }
                if (btn.Key == ConsoleKey.DownArrow && Game.snake.dir != 4)
                {
                    Game.snake.dir = 2;
                }
                if (btn.Key == ConsoleKey.LeftArrow && Game.snake.dir != 1)
                {
                    Game.snake.dir = 3;
                }
                if (btn.Key == ConsoleKey.UpArrow && Game.snake.dir != 2)
                {
                    Game.snake.dir = 4;
                }
            }
        }