Example #1
0
 public wall[] multi_set_color(wall[] obj_wall, Color clr)
 {
     wall[] tample = new wall[obj_wall.Length];
     for (int i = 0; i < obj_wall.Length; i++)
     {
         tample[i] = obj_wall[i];
         tample[i].PB.BackColor = clr;
     }
     return(tample);
 }
Example #2
0
 public wall[] multi_set_backround(wall[] obj_wall, bool backround)
 {
     wall[] tample = new wall[obj_wall.Length];
     for (int i = 0; i < obj_wall.Length; i++)
     {
         tample[i] = obj_wall[i];
         tample[i].is_backround = backround;
     }
     return(tample);
 }
Example #3
0
 //multi
 public wall[] multi_set_solid(wall[] obj_wall, bool solid)
 {
     wall[] tample = new wall[obj_wall.Length];
     for (int i = 0; i < obj_wall.Length; i++)
     {
         tample[i]          = obj_wall[i];
         tample[i].is_solid = solid;
     }
     return(tample);
 }
Example #4
0
 public wall[] multi_set_image(wall[] obj_wall, string url)
 {
     wall[] tample = new wall[obj_wall.Length];
     for (int i = 0; i < obj_wall.Length; i++)
     {
         tample[i] = obj_wall[i];
         tample[i].PB.Load(url);
         tample[i].PB.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Normal;
     }
     return(tample);
 }
Example #5
0
 //cons
 public wall[] cons_custom_wall(int x, int y, int size_x, int size_y)
 {
     wall[] tample = new wall[1];
     tample[0]             = new wall();
     tample[0].X           = x;
     tample[0].Y           = y;
     tample[0].size_X      = size_x;
     tample[0].size_Y      = size_y;
     tample[0].PB.Size     = new Size(tample[0].size_X, tample[0].size_Y);
     tample[0].PB.Location = new Point(tample[0].X, tample[0].Y);
     return(tample);
 }
Example #6
0
 public map1(int map)
 {
     amount_map[0]   = 9;
     map_constractor = new wall[amount_map[map]][];
     map1_setup();
     map_minimap = new wall[amount_map[map]][];
     for (int i = 0; i < amount_map[map]; i++)
     {
         //map_minimap[i] = wall.copy(map_constractor[i]);
         map_minimap[i] = new wall().size_change(map_minimap[i], 50);
         map_minimap[i] = new wall().multi_set_solid(map_minimap[i], true);
     }
 }
Example #7
0
 public wall[] solo_set_color(wall[] obj_wall, Color clr, int place)
 {
     wall[] tample = new wall[obj_wall.Length];
     for (int i = 0; i < obj_wall.Length; i++)
     {
         tample[i] = obj_wall[i];
         if (i == place)
         {
             tample[i].PB.BackColor = clr;
         }
     }
     return(tample);
 }
Example #8
0
 public wall[] solo_set_backround(wall[] obj_wall, bool backround, int place)
 {
     wall[] tample = new wall[obj_wall.Length];
     for (int i = 0; i < obj_wall.Length; i++)
     {
         tample[i] = obj_wall[i];
         if (i == place)
         {
             tample[i].is_backround = backround;
         }
     }
     return(tample);
 }
Example #9
0
 //solo
 public wall[] solo_set_solid(wall[] obj_wall, bool solid, int place)
 {
     wall[] tample = new wall[obj_wall.Length];
     for (int i = 0; i < obj_wall.Length; i++)
     {
         tample[i] = obj_wall[i];
         if (i == place)
         {
             tample[i].is_solid = solid;
         }
     }
     return(tample);
 }
Example #10
0
        public wall[] cons_five_cubes_X_big_structure(int x, int y)
        {
            wall[] tample = new wall[5];
            int    i      = 0;

            tample[i]             = new wall();
            tample[i].X           = x;
            tample[i].Y           = y;
            tample[i].size_X      = 50;
            tample[i].size_Y      = 50;
            tample[i].PB.Size     = new Size(tample[i].size_X, tample[i].size_Y);
            tample[i].PB.Location = new Point(tample[i].X, tample[i].Y);
            i++;
            tample[i]             = new wall();
            tample[i].X           = x + 150;
            tample[i].Y           = y;
            tample[i].size_X      = 50;
            tample[i].size_Y      = 50;
            tample[i].PB.Size     = new Size(tample[i].size_X, tample[i].size_Y);
            tample[i].PB.Location = new Point(tample[i].X, tample[i].Y);
            i++;
            tample[i]             = new wall();
            tample[i].X           = x + 75;
            tample[i].Y           = y + 75;
            tample[i].size_X      = 50;
            tample[i].size_Y      = 50;
            tample[i].PB.Size     = new Size(tample[i].size_X, tample[i].size_Y);
            tample[i].PB.Location = new Point(tample[i].X, tample[i].Y);
            i++;
            tample[i]             = new wall();
            tample[i].X           = x;
            tample[i].Y           = y + 150;
            tample[i].size_X      = 50;
            tample[i].size_Y      = 50;
            tample[i].PB.Size     = new Size(tample[i].size_X, tample[i].size_Y);
            tample[i].PB.Location = new Point(tample[i].X, tample[i].Y);
            i++;
            tample[i]             = new wall();
            tample[i].X           = x + 150;
            tample[i].Y           = y + 150;
            tample[i].size_X      = 50;
            tample[i].size_Y      = 50;
            tample[i].PB.Size     = new Size(tample[i].size_X, tample[i].size_Y);
            tample[i].PB.Location = new Point(tample[i].X, tample[i].Y);
            return(tample);
        }
Example #11
0
        public static wall copy(wall tocp)
        {
            wall send = new wall();

            send.X             = tocp.X;
            send.Y             = tocp.Y;
            send.size_X        = tocp.size_X;
            send.size_Y        = tocp.size_Y;
            send.is_alive      = tocp.is_alive;
            send.health        = tocp.health;
            send.is_solid      = tocp.is_solid;
            send.is_invincible = tocp.is_invincible;
            send.is_backround  = tocp.is_backround;
            send.is_attack     = tocp.is_attack;
            send.dmg           = tocp.dmg;
            send.PB            = tocp.PB;
            return(send);
        }
Example #12
0
 //convert other builds to wall
 public wall[] convert_trap_to_wall(trap[] obj_trap)
 {
     wall[] tample = new wall[obj_trap.Length];
     for (int i = 0; i < obj_trap.Length; i++)
     {
         tample[i]               = new wall();
         tample[i].X             = obj_trap[i].X;
         tample[i].Y             = obj_trap[i].Y;
         tample[i].size_X        = obj_trap[i].size_X;
         tample[i].size_Y        = obj_trap[i].size_Y;
         tample[i].is_alive      = obj_trap[i].is_alive;
         tample[i].health        = obj_trap[i].health;
         tample[i].is_solid      = obj_trap[i].is_solid;
         tample[i].is_invincible = obj_trap[i].is_invincible;
         tample[i].is_backround  = obj_trap[i].is_backround;
         tample[i].is_attack     = obj_trap[i].is_attack;
         tample[i].dmg           = obj_trap[i].dmg;
         tample[i].PB            = obj_trap[i].PB;
     }
     return(tample);
 }
Example #13
0
        public wall[] cons_smily_face_big_structure(int x, int y)
        {
            wall[] tample = new wall[4];
            int    i      = 0;

            tample[i]             = new wall();
            tample[i].X           = x + 50;
            tample[i].Y           = y;
            tample[i].size_X      = 20;
            tample[i].size_Y      = 60;
            tample[i].PB.Size     = new Size(tample[i].size_X, tample[i].size_Y);
            tample[i].PB.Location = new Point(tample[i].X, tample[i].Y);
            i++;
            tample[i]             = new wall();
            tample[i].X           = x + 120;
            tample[i].Y           = y;
            tample[i].size_X      = 20;
            tample[i].size_Y      = 60;
            tample[i].PB.Size     = new Size(tample[i].size_X, tample[i].size_Y);
            tample[i].PB.Location = new Point(tample[i].X, tample[i].Y);
            i++;
            tample[i]             = new wall();
            tample[i].X           = x;
            tample[i].Y           = y + 100;
            tample[i].size_X      = 60;
            tample[i].size_Y      = 20;
            tample[i].PB.Size     = new Size(tample[i].size_X, tample[i].size_Y);
            tample[i].PB.Location = new Point(tample[i].X, tample[i].Y);
            i++;
            tample[i]             = new wall();
            tample[i].X           = x + 100;
            tample[i].Y           = y + 100;
            tample[i].size_X      = 60;
            tample[i].size_Y      = 20;
            tample[i].PB.Size     = new Size(tample[i].size_X, tample[i].size_Y);
            tample[i].PB.Location = new Point(tample[i].X, tample[i].Y);

            return(tample);
        }
Example #14
0
        public wall[] cons_cube_hollow_X_entrence_big_structure(int x, int y)
        {
            wall[] tample = new wall[4];
            int    i      = 0;

            tample[i]             = new wall();
            tample[i].X           = x + 60;
            tample[i].Y           = y;
            tample[i].size_X      = 100;
            tample[i].size_Y      = 20;
            tample[i].PB.Size     = new Size(tample[i].size_X, tample[i].size_Y);
            tample[i].PB.Location = new Point(tample[i].X, tample[i].Y);
            i++;
            tample[i]             = new wall();
            tample[i].X           = x + 200;
            tample[i].Y           = y + 60;
            tample[i].size_X      = 20;
            tample[i].size_Y      = 100;
            tample[i].PB.Size     = new Size(tample[i].size_X, tample[i].size_Y);
            tample[i].PB.Location = new Point(tample[i].X, tample[i].Y);
            i++;
            tample[i]             = new wall();
            tample[i].X           = x;
            tample[i].Y           = y + 60;
            tample[i].size_X      = 20;
            tample[i].size_Y      = 100;
            tample[i].PB.Size     = new Size(tample[i].size_X, tample[i].size_Y);
            tample[i].PB.Location = new Point(tample[i].X, tample[i].Y);
            i++;
            tample[i]             = new wall();
            tample[i].X           = x + 60;
            tample[i].Y           = y + 200;
            tample[i].size_X      = 100;
            tample[i].size_Y      = 20;
            tample[i].PB.Size     = new Size(tample[i].size_X, tample[i].size_Y);
            tample[i].PB.Location = new Point(tample[i].X, tample[i].Y);
            return(tample);
        }
Example #15
0
        public void map1_setup()
        {
            int    count = 0;
            bool   skip  = false;
            string line;

            // Read the file and display it line by line.
            using (StreamReader file = new System.IO.StreamReader(@"C:\Users\user10\Desktop\2d_game\2d_game\data\new  1.txt"))
            {
                while ((line = file.ReadLine()) != null && skip == false)
                {
                    if (line.IndexOf("::", 0) == 0)
                    {
                    }
                    else if (line.Contains("wall()") == true)
                    {
                        string[] data  = line.Split('(');
                        string[] stats = data[2].Substring(0, data[2].Length - 1).Split(',');
                        if (line.Contains("cons_") == true)
                        {
                            if (line.Contains("custom_wall") == true)
                            {
                                map_constractor[count] = new wall().cons_custom_wall(int.Parse(stats[0]), int.Parse(stats[1]), int.Parse(stats[2]), int.Parse(stats[3]));
                            }
                            else if (line.Contains("plus_big_structure") == true)
                            {
                                map_constractor[count] = new wall().cons_plus_big_structure(int.Parse(stats[0]), int.Parse(stats[1]));
                            }
                            else if (line.Contains("cube_hollow_X_entrence_big_structure") == true)
                            {
                                map_constractor[count] = new wall().cons_cube_hollow_X_entrence_big_structure(int.Parse(stats[0]), int.Parse(stats[1]));
                            }
                            else if (line.Contains("five_cubes_X_big_structure") == true)
                            {
                                map_constractor[count] = new wall().cons_five_cubes_X_big_structure(int.Parse(stats[0]), int.Parse(stats[1]));
                            }
                            else if (line.Contains("smily_face_big_structure") == true)
                            {
                                map_constractor[count] = new wall().cons_smily_face_big_structure(int.Parse(stats[0]), int.Parse(stats[1]));
                            }
                        }
                        else if (line.Contains("multi_") == true)
                        {
                            if (line.Contains("set_solid") == true)
                            {
                                map_constractor[count] = new wall().multi_set_solid(map_constractor[count], Parse(stats[1]));
                            }
                            else if (line.Contains("set_backround") == true)
                            {
                                map_constractor[count] = new wall().multi_set_backround(map_constractor[count], Parse(stats[1]));
                            }
                            else if (line.Contains("set_image") == true)
                            {
                                map_constractor[count] = new wall().multi_set_image(map_constractor[count], stats[1].Substring(1, stats[1].Length - 2));
                            }
                            else if (line.Contains("set_color") == true)
                            {
                                map_constractor[count] = new wall().multi_set_color(map_constractor[count], color(stats[1]));
                            }
                        }
                        else if (line.Contains("solo_") == true)
                        {
                            if (line.Contains("set_solid") == true)
                            {
                                map_constractor[count] = new wall().solo_set_solid(map_constractor[count], Parse(stats[1]), int.Parse(stats[2]));
                            }
                            else if (line.Contains("set_backround") == true)
                            {
                                map_constractor[count] = new wall().solo_set_backround(map_constractor[count], Parse(stats[1]), int.Parse(stats[2]));
                            }
                            else if (line.Contains("set_image") == true)
                            {
                                map_constractor[count] = new wall().solo_set_image(map_constractor[count], stats[1].Substring(1, stats[1].Length - 2), int.Parse(stats[2]));
                            }
                            else if (line.Contains("set_color") == true)
                            {
                                map_constractor[count] = new wall().solo_set_color(map_constractor[count], color(stats[1]), int.Parse(stats[2]));
                            }
                        }
                        else if (line.Contains("convert_") == true)
                        {
                            if (line.Contains("trap_to_wall") == true)
                            {
                                if (line.Contains("trap()."))
                                {
                                    if (line.Contains("custom_wall") == true)
                                    {
                                        map_constractor[count] = new wall().convert_trap_to_wall(new trap().cons_custom_wall(int.Parse(stats[0]), int.Parse(stats[1]), int.Parse(stats[2]), int.Parse(stats[3])));
                                    }
                                }
                            }
                        }
                    }
                    if (line == "!" && skip == false)
                    {
                        count++;
                    }
                    if (line == "Ω")
                    {
                        skip = true;
                    }
                }
            }

            //map_constractor[count] = new wall().cons_custom_wall(-100,-50,90,30);
            //count++;
            //map_constractor[count] = new wall().cons_custom_wall(100, -50, 90, 30);

            //map_constractor[count] = new wall().multi_set_solid(map_constractor[count], false);
            //map_constractor[count] = new wall().multi_set_backround(map_constractor[count], true);

            //count++;
            //map_constractor[count] = new wall().cons_plus_big_structure(-150,300);
            //count++;
            //map_constractor[count] = new wall().cons_cube_hollow_X_entrence_big_structure(0, -300);
            //count++;
            //map_constractor[count] = new wall().cons_plus_big_structure(500, 500);
            //count++;
            //map_constractor[count] = new wall().cons_cube_hollow_X_entrence_big_structure(550, 550);
            //count++;
            //map_constractor[count] = new wall().cons_five_cubes_X_big_structure(-300, 100);
            //count++;
            //map_constractor[count] = new wall().cons_five_cubes_X_big_structure(-150, -300);

            //map_constractor[count] = new wall().solo_set_image(map_constractor[count],"https://i.ytimg.com/vi/h-cmvEFE7-E/hqdefault.jpg?custom=true&w=168&h=94&stc=true&jpg444=true&jpgq=90&sp=67&sigh=d3bmrUp0-Ea3CjdP0RDTAEbXfbU", 2);

            //count++;
            //map_constractor[count] = new wall().cons_smily_face_big_structure(-500, -500);
            //count++;
            //map_constractor[count] = new wall().convert_trap_to_wall(new trap().cons_big_cube(300, 0));
        }