Example #1
0
        // Movimento do personagem
        public static void CharacterMovement()
        {
            #region Variável Local
            Character      chr = new Character();
            MenuJogo       mj  = new MenuJogo();
            ConsoleKeyInfo input;
            WriteLines.Character_InputESC();
            WriteLines.Character_InputQ();
            #endregion

            do
            {
                input = Console.ReadKey(true);
                Console.SetCursorPosition(chr.leftAndRight, chr.upAndDown);
                Console.WriteLine(" ");
                switch (input.Key)
                {
                case ConsoleKey.RightArrow:
                    chr.leftAndRight++;
                    break;

                case ConsoleKey.LeftArrow:
                    chr.leftAndRight--;
                    break;

                case ConsoleKey.DownArrow:
                    chr.upAndDown++;
                    break;

                case ConsoleKey.UpArrow:
                    chr.upAndDown--;
                    break;

                case ConsoleKey.Escape:
                    WriteLines.Character_Movement_Space();
                    MenuJogo.GameMenu();
                    break;

                case ConsoleKey.Q:
                    Environment.Exit(0);
                    break;
                }
                Console.SetCursorPosition(chr.leftAndRight, chr.upAndDown);
                Console.Write(chr.charGameObject);
            }while (chr.gameOver == 0);

            if (chr.gameOver == 1)
            {
                Console.Beep();
            }
        }