Beispiel #1
0
        static void Main(string[] args)
        {
            int w = 50;
            int h = 150;

            Console.WindowHeight   = w;
            Console.BufferHeight   = w;
            Console.WindowWidth    = h;
            Console.BufferWidth    = h;
            Console.OutputEncoding = System.Text.Encoding.Unicode;
            int[,] matrix          = new int[w - 2, h - 2];

            HeroV2 play = new HeroV2(20, 20, 3);

            play.PlaceInGrid(matrix);

            Boss b = new Boss(10, 10, 3);

            Console.WriteLine(printGridV2(matrix));
            List <ProjectileV2> missles = new List <ProjectileV2>();

            while (true)
            {
                HeroMoveV2(play, missles, matrix);
                foreach (var item in missles)
                {
                    item.PlaceInGrid(matrix);

                    if (item.core.x == 1 || item.core.x == w - 2)
                    {
                        item.RemoveFromGrid(matrix);
                    }

                    if (item.core.y == 1 || item.core.y == h - 2)
                    {
                        item.RemoveFromGrid(matrix);
                    }
                }

                missles.RemoveAll(o => o.core.x == 1 || o.core.x == w - 2);
                missles.RemoveAll(o => o.core.y == 1 || o.core.y == h - 2);
                foreach (var item in missles)
                {
                    item.TimeProgress(matrix);
                }
                b.Move(matrix);
                Console.WriteLine(printGridV2(matrix));
                Thread.Sleep(250);
                foreach (var item in missles)
                {
                    item.RemoveFromGrid(matrix);
                    item.TimeProgress(matrix);
                }

                Console.SetCursorPosition(0, 0);
            }
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            int w = 50;
            int h = 150;
            Console.WindowHeight = w;
            Console.BufferHeight = w;
            Console.WindowWidth = h;
            Console.BufferWidth = h;
            Console.OutputEncoding = System.Text.Encoding.Unicode;
            int[,] matrix = new int[w - 2, h - 2];

            HeroV2 play = new HeroV2(20, 20, 3);
            play.PlaceInGrid(matrix);

            Boss b = new Boss(10, 10, 3);
            Console.WriteLine(printGridV2(matrix));
            List<ProjectileV2> missles = new List<ProjectileV2>();

            while (true)
            {
                HeroMoveV2(play, missles, matrix);
                foreach (var item in missles)
                {
                    item.PlaceInGrid(matrix);

                    if(item.core.x == 1 || item.core.x == w - 2)
                    {
                        item.RemoveFromGrid(matrix);
                    }

                    if(item.core.y == 1 || item.core.y == h - 2)
                    {
                        item.RemoveFromGrid(matrix);
                    }

                }

                missles.RemoveAll(o => o.core.x == 1 || o.core.x == w - 2);
                missles.RemoveAll(o => o.core.y == 1 || o.core.y == h - 2);
                foreach (var item in missles)
                {

                    item.TimeProgress(matrix);
                }
                b.Move(matrix);
                Console.WriteLine(printGridV2(matrix));
                Thread.Sleep(250);
                foreach (var item in missles)
                {
                    item.RemoveFromGrid(matrix);
                    item.TimeProgress(matrix);
                }

                Console.SetCursorPosition(0, 0);
            }
        }