Beispiel #1
0
 public void Destroy(meteor met, EventArgs e)
 {
     try
     {
         met.BackgroundImage       = Image.FromFile("explode.jpg");
         met.BackgroundImageLayout = ImageLayout.Stretch;
         AsteroidDestroy.Enabled   = true;
     }
     catch { };
     met.Dispose();
 }
Beispiel #2
0
 private void MeteorTime_Tick(object sender, EventArgs e)
 {
     foreach (Control control in splitContainer1.Panel2.Controls)
     {
         meteor tb = control as meteor;
         if (tb != null)
         {
             if (tb.Left + tb.Width + 10 < splitContainer1.Width)
             {
                 tb.Left += MeteorSpeed;
             }
             else
             {
                 tb.Dispose();
             }
             if
             (
                 (
                     (
                         (tb.Top <= BattleShip.Top)
                         ||
                         (tb.Top <= BattleShip.Top + BattleShip.Height)
                     )
                     &&
                     (
                         (tb.Top + Meteor.Height >= BattleShip.Top)
                         ||
                         (tb.Top + Meteor.Height >= BattleShip.Top + BattleShip.Height)
                     )
                 )
                 &&
                 (
                     (
                         (tb.Left <= BattleShip.Left)
                         ||
                         (tb.Left <= BattleShip.Left + BattleShip.Width)
                     )
                     &&
                     (
                         (tb.Left + Meteor.Width >= BattleShip.Left)
                         ||
                         (tb.Left + Meteor.Width >= BattleShip.Left + BattleShip.Width)
                     )
                 )
             )
             {
                 int Wid = tb.Width;
                 Destroy(tb, e);
                 if (!failed)
                 {
                     if (!tb.Disposing)
                     {
                         if (tb.BackColor == Color.Brown)
                         {
                             Damage(Wid);
                         }
                         if (tb.BackColor == Color.Blue)
                         {
                             if (LaserLvl < MaxLaserLvl)
                             {
                                 LaserLvl++;
                             }
                             Score += BonusScore;
                         }
                         if (tb.BackColor == Color.Lime)
                         {
                             progressBar3.Maximum += NRJBonusCoast;
                             progressBar3.Value    = progressBar3.Maximum;
                             Score += BonusScore;
                             NRJrestoreVal++;
                         }
                     }
                 }
             }
         }
     }
 }