Ejemplo n.º 1
0
        static public void PlayGame()
        {
            Console.Clear();
            TheGame     theGame     = new TheGame(1, 1);
            HUD         hud         = new HUD(Menu.SelectedName, theGame.Snakes[0].Lenght);
            LimitBorder limitBorder = new LimitBorder(new Coordinate(1, 7), new Coordinate(59, 29), '@');

            double   frameRate = 1000 / 15;
            DateTime lastDate  = DateTime.Now;

            while (!theGame.Exit)
            {
                theGame.Snakes[0].ChangeDirection();
                if ((DateTime.Now - lastDate).TotalMilliseconds >= frameRate)
                {
                    theGame.Play();
                    hud.ScoreRefresh(theGame.Snakes[0].Lenght);
                    lastDate = DateTime.Now;
                }
            }
            string nextMenu = Menu.ShowAfterDeath();

            Core.OpenMenu(nextMenu);
        }