Beispiel #1
0
        public static void HeroMoveV2(HeroV2 h, List<ProjectileV2> p, int[,] grid)
        {
            if (Console.KeyAvailable)
            {
                ConsoleKeyInfo userInput = Console.ReadKey();
                if (userInput.Key == ConsoleKey.LeftArrow && h.core.y >= 1)
                {
                    h.Move(1, grid);
                }
                if (userInput.Key == ConsoleKey.RightArrow && h.core.y <= grid.GetLength(1) - 2)
                {
                    h.Move(-1, grid);
                }
                if (userInput.Key == ConsoleKey.UpArrow && h.core.x >= 5)
                {
                    h.Move(2, grid);
                }
                if (userInput.Key == ConsoleKey.DownArrow && h.core.x < grid.GetLength(0) - 1)
                {
                    h.Move(-2, grid);
                }

                if (userInput.Key == ConsoleKey.Spacebar)
                {
                    h.Fire(p, grid);
                }

            }

            while (Console.KeyAvailable)
            {
                ConsoleKeyInfo userInput = Console.ReadKey();
            }
        }
Beispiel #2
0
        static public void HeroMoveV2(HeroV2 h, List <ProjectileV2> p, int[,] grid)
        {
            if (Console.KeyAvailable)
            {
                ConsoleKeyInfo userInput = Console.ReadKey();
                if (userInput.Key == ConsoleKey.LeftArrow && h.core.y >= 1)
                {
                    h.Move(1, grid);
                }
                if (userInput.Key == ConsoleKey.RightArrow && h.core.y <= grid.GetLength(1) - 2)
                {
                    h.Move(-1, grid);
                }
                if (userInput.Key == ConsoleKey.UpArrow && h.core.x >= 5)
                {
                    h.Move(2, grid);
                }
                if (userInput.Key == ConsoleKey.DownArrow && h.core.x < grid.GetLength(0) - 1)
                {
                    h.Move(-2, grid);
                }

                if (userInput.Key == ConsoleKey.Spacebar)
                {
                    h.Fire(p, grid);
                }
            }

            while (Console.KeyAvailable)
            {
                ConsoleKeyInfo userInput = Console.ReadKey();
            }
        }