示例#1
0
文件: Program.cs 项目: aimlee/PPII
        static void Main(string[] args)
        {
            Console.WriteLine(" ");
            Console.WriteLine(" ");

            Console.WriteLine("     Score: ");
            Console.WriteLine("     " + Game.a);

            Game.Gamesize();

            if (Game.GameOver(Game.Wall))
            {
                Console.Clear();
                Game.snake.body = new List <Point>();

                Game.snake.body.Add(new Point(16, 7));
                Game.snake.body.Add(new Point(15, 7));
                Game.snake.body.Add(new Point(14, 7));
            }

            Thread t = new Thread(MoveSnakeThread);

            t.Start();


            while (!Game.GameOver(Game.Wall))
            {
                ConsoleKeyInfo btn = Console.ReadKey();
                switch (btn.Key)
                {
                case ConsoleKey.UpArrow:
                    direction = 4;
                    break;

                case ConsoleKey.DownArrow:
                    direction = 2;
                    break;

                case ConsoleKey.LeftArrow:
                    direction = 3;
                    break;

                case ConsoleKey.RightArrow:
                    direction = 1;
                    break;
                }
            }
        }