示例#1
0
 //взрыв бомбы
 public void bang(int I, int J, hero A)
 {
     if (this.banged == false)
     {
         if (this.bomb_pos_i == I && this.bomb_pos_j == J)
         {
             if (this.bomb_roll_i == this.bomb_pos_i || this.bomb_roll_i == -1)
             {
                 if (this.bomb_roll_j == this.bomb_pos_j || this.bomb_roll_j == -1)
                 {
                     A.M[this.bomb_pos_i, this.bomb_pos_j] = " ";
                     this.fire_pos_i  = this.bomb_pos_i;
                     this.fire_pos_j  = this.bomb_pos_j;
                     this.bomb_pos_i  = -1;
                     this.bomb_pos_j  = -1;
                     this.bomb_roll_i = -1;
                     this.bomb_roll_j = -1;
                     bomb_time        = 0;
                     bomb_time_roll   = 0;
                     curent_time_bomb = 0;
                     this.banged      = true;
                     bomb_roll_napr   = "stop";
                     fire             = true;
                     A.bangSound.Play(0.1f, 0.0f, 0.0f);
                 }
             }
         }
     }
 }
示例#2
0
 public Game1()
 {
     graphics = new GraphicsDeviceManager(this);
     Content.RootDirectory              = "Content";
     graphics.PreferredBackBufferWidth  = 1000;  // ширина приложения
     graphics.PreferredBackBufferHeight = 640;   // высота приложения
     graphics.IsFullScreen              = false; // флаг полноэкранного приложения
     graphics.ApplyChanges();                    // применяем параметры
     HERO = new hero(5);
 }
示例#3
0
 // контроль взрыва бомбы
 public void bang_control(GameTime gameTime, hero A)
 {
     this.curent_time_bomb += (float)gameTime.ElapsedGameTime.TotalSeconds;
     if (this.curent_time_bomb > 3)
     {
         if (!this.banged)
         {
             this.bang(this.bomb_pos_i, this.bomb_pos_j, A);
         }
     }
 }
示例#4
0
            public void bang_fire(GameTime gameTime, hero A)
            {
                fire_time += (float)gameTime.ElapsedGameTime.TotalMilliseconds;
                if (fire_time > 10)
                {
                    if (rad_fire == 0)
                    {
                        if (A.player_pos_i == this.fire_pos_i && A.player_pos_j == this.fire_pos_j)
                        {
                            A.player_dead = true;
                            A.player_dead_mus.Play(0.1f, 0.0f, 0.0f);
                        }
                        A.M[this.fire_pos_i, this.fire_pos_j] = "*";
                    }
                    else
                    {
                        if (this.fire_pos_j + this.rad_fire < A.size2 - 1 && A.M[this.fire_pos_i, this.fire_pos_j + this.rad_fire] != "0")
                        {
                            if (right_fire == true)
                            {
                                if (A.M[this.fire_pos_i, this.fire_pos_j + this.rad_fire] == "P")
                                {
                                    A.player_dead = true;
                                    A.player_dead_mus.Play(0.1f, 0.0f, 0.0f);
                                }
                                // if (A.M[this.fire_pos_i, this.fire_pos_j + this.rad_fire] == "B")
                                {
                                    foreach (bomb X in A.bomb_list)
                                    {
                                        if (X.bomb_pos_i == this.fire_pos_i && X.bomb_pos_j == this.fire_pos_j + this.rad_fire)
                                        {
                                            X.bang(this.fire_pos_i, this.fire_pos_j + this.rad_fire, A);
                                        }
                                    }
                                }
                                if (!A.is_empty/*_for_bomb*/ (this.fire_pos_i, this.fire_pos_j + this.rad_fire))
                                {
                                    right_fire = false;
                                }
                                A.M[this.fire_pos_i, this.fire_pos_j + this.rad_fire] = "*";
                            }
                        }

                        if (this.fire_pos_j - this.rad_fire > 0 && A.M[this.fire_pos_i, this.fire_pos_j - this.rad_fire] != "0")
                        {
                            if (left_fire == true)
                            {
                                if (A.M[this.fire_pos_i, this.fire_pos_j - this.rad_fire] == "P")
                                {
                                    A.player_dead = true;
                                    A.player_dead_mus.Play(0.1f, 0.0f, 0.0f);
                                }
                                // if (A.M[this.fire_pos_i, this.fire_pos_j - this.rad_fire] == "B")
                                {
                                    foreach (bomb X in A.bomb_list)
                                    {
                                        if (X.bomb_pos_i == this.fire_pos_i && X.bomb_pos_j == this.fire_pos_j - this.rad_fire)
                                        {
                                            X.bang(this.fire_pos_i, this.fire_pos_j - this.rad_fire, A);
                                        }
                                    }
                                }

                                if (!A.is_empty/*_for_bomb*/ (this.fire_pos_i, this.fire_pos_j - this.rad_fire))
                                {
                                    left_fire = false;
                                }
                                A.M[this.fire_pos_i, this.fire_pos_j - this.rad_fire] = "*";
                            }
                        }

                        if (this.fire_pos_i - this.rad_fire > 0 && A.M[this.fire_pos_i - this.rad_fire, this.fire_pos_j] != "0")
                        {
                            if (up_fire == true)
                            {
                                if (A.M[this.fire_pos_i - this.rad_fire, this.fire_pos_j] == "P")
                                {
                                    A.player_dead = true;
                                    A.player_dead_mus.Play(0.1f, 0.0f, 0.0f);
                                }
                                // if (A.M[this.fire_pos_i - this.rad_fire, this.fire_pos_j] == "B")
                                {
                                    foreach (bomb X in A.bomb_list)
                                    {
                                        if (X.bomb_pos_i == this.fire_pos_i - this.rad_fire && X.bomb_pos_j == this.fire_pos_j)
                                        {
                                            X.bang(this.fire_pos_i - this.rad_fire, this.fire_pos_j, A);
                                        }
                                    }
                                }
                                if (!A.is_empty/*_for_bomb*/ (this.fire_pos_i - this.rad_fire, this.fire_pos_j))
                                {
                                    up_fire = false;
                                }
                                A.M[this.fire_pos_i - this.rad_fire, this.fire_pos_j] = "*";
                            }
                        }
                        if (this.fire_pos_i + this.rad_fire < A.size1 - 1 && A.M[this.fire_pos_i + this.rad_fire, this.fire_pos_j] != "0")
                        {
                            if (down_fire == true)
                            {
                                if (A.M[this.fire_pos_i + this.rad_fire, this.fire_pos_j] == "P")
                                {
                                    A.player_dead = true;
                                    A.player_dead_mus.Play(0.1f, 0.0f, 0.0f);
                                }
                                //if (A.M[this.fire_pos_i + this.rad_fire, this.fire_pos_j] == "B")
                                {
                                    foreach (bomb X in A.bomb_list)
                                    {
                                        if (X.bomb_pos_i == this.fire_pos_i + this.rad_fire && X.bomb_pos_j == this.fire_pos_j)
                                        {
                                            X.bang(this.fire_pos_i + this.rad_fire, this.fire_pos_j, A);
                                        }
                                    }
                                }
                                if (!A.is_empty/*_for_bomb*/ (this.fire_pos_i + this.rad_fire, this.fire_pos_j))
                                {
                                    down_fire = false;
                                }
                                A.M[this.fire_pos_i + this.rad_fire, this.fire_pos_j] = "*";
                            }
                        }
                    }
                }
                if (fire_time > 60)
                {
                    if (rad_fire == 0)
                    {
                        A.M[this.fire_pos_i, this.fire_pos_j] = " ";
                    }
                    else
                    {
                        if (this.fire_pos_j + this.rad_fire < A.size2 - 1 && A.M[this.fire_pos_i, this.fire_pos_j + this.rad_fire] != "0")
                        {
                            if (right_space == true)
                            {
                                if (A.M[this.fire_pos_i, this.fire_pos_j + this.rad_fire] == "P")
                                {
                                    A.player_dead = true;
                                }
                                A.M[this.fire_pos_i, this.fire_pos_j + this.rad_fire] = " ";
                                if (right_fire == false)
                                {
                                    right_space = false;
                                }
                            }
                        }
                        if (this.fire_pos_j - this.rad_fire > 0 && A.M[this.fire_pos_i, this.fire_pos_j - this.rad_fire] != "0")
                        {
                            if (left_space == true)
                            {
                                if (A.M[this.fire_pos_i, this.fire_pos_j - this.rad_fire] == "P")
                                {
                                    A.player_dead = true;
                                }
                                A.M[this.fire_pos_i, this.fire_pos_j - this.rad_fire] = " ";
                                if (left_fire == false)
                                {
                                    left_space = false;
                                }
                            }
                        }
                        if (this.fire_pos_i - this.rad_fire > 0 && A.M[this.fire_pos_i - this.rad_fire, this.fire_pos_j] != "0")
                        {
                            if (up_space == true)
                            {
                                if (A.M[this.fire_pos_i - this.rad_fire, this.fire_pos_j] == "P")
                                {
                                    A.player_dead = true;
                                }
                                A.M[this.fire_pos_i - this.rad_fire, this.fire_pos_j] = " ";
                                if (up_fire == false)
                                {
                                    up_space = false;
                                }
                            }
                        }
                        if (this.fire_pos_i + this.rad_fire < A.size1 - 1 && A.M[this.fire_pos_i + this.rad_fire, this.fire_pos_j] != "0")
                        {
                            if (down_space == true)
                            {
                                if (A.M[this.fire_pos_i + this.rad_fire, this.fire_pos_j] == "P")
                                {
                                    A.player_dead = true;
                                }
                                A.M[this.fire_pos_i + this.rad_fire, this.fire_pos_j] = " ";
                                if (down_fire == false)
                                {
                                    down_space = false;
                                }
                            }
                        }
                    }
                    if (this.rad_fire < A.rad_bang)
                    {
                        this.fire_time = 0;
                        this.rad_fire++;
                    }
                    else
                    {
                        this.fire  = false;
                        this.fired = true;
                    }
                }
            }
示例#5
0
 //момент качения бомбы
 public void rolling_2(GameTime gameTime, hero A)
 {
     if (this.bomb_pos_i == this.bomb_roll_i && this.bomb_pos_j == this.bomb_roll_j)
     {
         if (bomb_roll_napr == "down")
         {
             if (A.is_empty_for_bomb(this.bomb_pos_i + 1, this.bomb_pos_j))
             {
                 A.M[this.bomb_pos_i, this.bomb_pos_j] = " ";
                 this.bomb_roll_i++;
                 this.bomb_pos_i = this.bomb_roll_i;
                 A.M[this.bomb_pos_i, this.bomb_pos_j] = "B";
                 bomb_time_roll = 0;
             }
             else
             {
                 this.bomb_roll_i    = -1;
                 this.bomb_roll_j    = -1;
                 this.bomb_roll_napr = "stop";
             }
         }
         if (bomb_roll_napr == "up")
         {
             if (A.is_empty_for_bomb(this.bomb_pos_i - 1, this.bomb_pos_j))
             {
                 A.M[this.bomb_pos_i, this.bomb_pos_j] = " ";
                 this.bomb_roll_i--;
                 this.bomb_pos_i = this.bomb_roll_i;
                 A.M[this.bomb_pos_i, this.bomb_pos_j] = "B";
                 bomb_time_roll = 0;
             }
             else
             {
                 this.bomb_roll_i    = -1;
                 this.bomb_roll_j    = -1;
                 this.bomb_roll_napr = "stop";
             }
         }
         if (bomb_roll_napr == "right")
         {
             if (A.is_empty_for_bomb(this.bomb_pos_i, this.bomb_pos_j - 1))
             {
                 A.M[this.bomb_pos_i, this.bomb_pos_j] = " ";
                 this.bomb_roll_j--;
                 this.bomb_pos_j = this.bomb_roll_j;
                 A.M[this.bomb_pos_i, this.bomb_pos_j] = "B";
                 bomb_time_roll = 0;
             }
             else
             {
                 this.bomb_roll_i    = -1;
                 this.bomb_roll_j    = -1;
                 this.bomb_roll_napr = "stop";
             }
         }
         if (bomb_roll_napr == "left")
         {
             if (A.is_empty_for_bomb(this.bomb_pos_i, this.bomb_pos_j + 1))
             {
                 A.M[this.bomb_pos_i, this.bomb_pos_j] = " ";
                 this.bomb_roll_j++;
                 this.bomb_pos_j = this.bomb_roll_j;
                 A.M[this.bomb_pos_i, this.bomb_pos_j] = "B";
                 bomb_time_roll = 0;
             }
             else
             {
                 this.bomb_roll_i    = -1;
                 this.bomb_roll_j    = -1;
                 this.bomb_roll_napr = "stop";
             }
         }
     }
 }