Example #1
0
        static void Main(string[] args)
        {
            GameState game = new GameState();

            game.ShowBanner();
            game.GetInput();
            Console.Clear();
            game.Draw();
            game.Run();
            while (!gameover)
            {
                ConsoleKeyInfo consoleKeyInfo = Console.ReadKey();
                if (consoleKeyInfo.Key == ConsoleKey.K)
                {
                    Serialize(game);
                }
                else if (consoleKeyInfo.Key == ConsoleKey.L)
                {
                    game.Stop();
                    game = Deserialize();
                    game.Draw();
                    game.Run();
                }
                else
                {
                    game.ProcessKeyEvent(consoleKeyInfo);
                }
            }
        }
Example #2
0
        static void Main(string[] args)
        {
            GameState game = new GameState();

            player.SetName();
            game.Run();
            while (true)
            {
                player.Draw();
                ConsoleKeyInfo consoleKeyInfo = Console.ReadKey();
                if (consoleKeyInfo.Key == ConsoleKey.F2)
                {
                    Serialize(game);
                }
                else if (consoleKeyInfo.Key == ConsoleKey.F3)
                {
                    game.Stop();
                    game = Deserialize();
                    game.Run();
                }
                else
                {
                    game.ProcessKeyEvent(consoleKeyInfo);
                }
            }
        }
Example #3
0
        static void Main(string[] args)
        {
            GameState gameState = new GameState();

            if (!end)
            {
                gameState.Run();
            }

            while (!end)
            {
                gameState.Draw();
                ConsoleKeyInfo consoleKeyInfo = Console.ReadKey();
                switch (consoleKeyInfo.Key)
                {
                case ConsoleKey.F2:
                    gameState.Save();
                    break;

                case ConsoleKey.F3:
                    gameState.Reset();
                    gameState = gameState.Load();
                    gameState.Run();
                    break;

                default:
                    gameState.PressedKey(consoleKeyInfo);
                    break;
                }
            }
        }
Example #4
0
        static void Main(string[] args)
        {
            GameState gameState = new GameState();

            while (!GameState.GameOver)
            {
                gameState.Run();
            }
        }
Example #5
0
        static void Main(string[] args)
        {
            GameState gameState = new GameState();

            gameState.Run();

            while (true)
            {
                ConsoleKeyInfo consoleKeyInfo = Console.ReadKey();
                gameState.PressedKey(consoleKeyInfo);
            }
        }
Example #6
0
        static void Main(string[] args)
        {
            Task task = new Task(new Action(DoIt));

            task.Start();
            gameState.Run();

            while (true)
            {
                gameState.ChangeFrame();
                Thread.Sleep(120);
            }
        }
Example #7
0
        static void Main(string[] args)
        {
            GameState game = new GameState();
            project1  gg   = new project1();

            while (true)
            {
                Console.SetCursorPosition(1, 20);

                cpp();
                Console.SetCursorPosition(24, 20);
                gg.anton(Console.ReadLine());
                Console.SetCursorPosition(1, 20);
                Console.WriteLine("                                       ");

                break;
            }

            game.Run(gg.str());
            while (true)
            {
                ConsoleKeyInfo consoleKeyInfo = Console.ReadKey();
                if (consoleKeyInfo.Key == ConsoleKey.F2)
                {
                    Serialize(game);
                }
                else if (consoleKeyInfo.Key == ConsoleKey.F3)
                {
                    game.Stop();
                    game = Deserialize();
                    game.Run(gg.str());
                }
                else
                {
                    game.ProcessKeyEvent(consoleKeyInfo);
                }
            }
        }
Example #8
0
        static void Main(string[] args)
        {
            Nextlvl.Deserialize();
            GameState game = new GameState();

            if (Returnlvl.count == 1)
            {
                Butter.username = Returnlvl.login;
                Butter.score    = Returnlvl.score;
                Savescore.Deserialize();
                Console.Clear();

                game.Run2();

                while (true)
                {
                    if (Butter.gameOver)
                    {
                        GameState.gameover();
                    }
                    game.DrawScore();

                    ConsoleKeyInfo consoleKeyInfo = Console.ReadKey();
                    game.ProcessKeyEvent(consoleKeyInfo);
                }
            }
            else
            {
                Console.WriteLine("Champions:");
                Savescore.Deserialize();
                DesOutput.PrintScore();
                Console.WriteLine("Enter username:");
                Butter.username = Console.ReadLine();
                Console.Clear();
                game.Run();


                while (true)
                {
                    if (Butter.gameOver)
                    {
                        GameState.gameover();
                    }
                    ConsoleKeyInfo consoleKeyInfo = Console.ReadKey();
                    game.ProcessKeyEvent(consoleKeyInfo);
                    game.DrawScore();
                }
            }
        }
Example #9
0
        static void DoIt()
        {
            while (true)
            {
                consoleKeyInfo = Console.ReadKey();

                switch (consoleKeyInfo.Key)
                {
                case ConsoleKey.F2:
                    gameState.Save();
                    break;

                case ConsoleKey.F3:
                    Console.Clear();
                    gameState = gameState.Load();
                    gameState.Run();
                    break;

                default:
                    gameState.ProcessKey(consoleKeyInfo);
                    break;
                }
            }
        }
Example #10
0
        static void Main(string[] args)
        {
            string[] Option = new string[2];
            Option[0] = "Start";
            Option[1] = "Difficult";
            GameState gameState = new GameState();
            Interface menu      = new Interface {
                Diff          = 0,
                Options       = Option,
                SelectedIndex = 0
            };
            Menu m    = Menu.main;
            bool res  = false;
            int  diff = 0;

            while (!res)
            {
                if (m == Menu.main)
                {
                    menu.Draw();
                }
                else
                {
                    menu.Option();
                }
                ConsoleKeyInfo Key = Console.ReadKey();
                switch (Key.Key)
                {
                case ConsoleKey.UpArrow:
                    menu.SelectedIndex++;
                    break;

                case ConsoleKey.DownArrow:
                    menu.SelectedIndex--;
                    break;

                case ConsoleKey.RightArrow:
                    if (menu.SelectedIndex == 1)
                    {
                        menu.Diff++;
                    }
                    break;

                case ConsoleKey.LeftArrow:
                    if (menu.SelectedIndex == 1)
                    {
                        menu.Diff--;
                    }
                    break;

                case ConsoleKey.Enter:
                    if (menu.SelectedIndex == 1)
                    {
                        m = Menu.Option;
                        Console.WriteLine("Press ESC");
                    }
                    else
                    {
                        m   = Menu.main;
                        res = true;
                    }
                    break;

                case ConsoleKey.Escape:
                    if (menu.SelectedIndex == 1)
                    {
                        diff = menu.Diff;
                        m    = Menu.main;
                    }
                    else
                    {
                        Environment.Exit(0);
                    }
                    break;
                }
            }
            Console.Clear();
            gameState.AskName();
            gameState.Run(diff);
            gameState.Generate();
            gameState.Score(0);
            while (true)
            {
                ConsoleKeyInfo consoleKey = Console.ReadKey();
                switch (consoleKey.Key)
                {
                case ConsoleKey.F4:
                    gameState = gameState.Load();
                    break;

                case ConsoleKey.F5:
                    gameState.Save();
                    break;

                default:
                    gameState.PressedKey(consoleKey);
                    break;
                }
            }
        }