Exemplo n.º 1
0
 private void AtckTmr_Tick(object sender, EventArgs e)
 {
     Atck++;
     if (!(Atck < 30))
     {
         foreach (PictureBox weapon in Controls)
         {
             if ((string)weapon.Tag == "Weapon")
             {
                 Controls.Remove(weapon);
                 zasah = false;
                 AtckTmr.Stop();
             }
         }
     }
     else
     {
         if (Left && collision.CollisionRight(Player, Controls))
         {
             foreach (PictureBox weapon in Controls)
             {
                 if ((string)weapon.Tag == "Weapon")
                 {
                     weapon.Left -= PlayerSpeed;
                 }
             }
         }
         if (Right && collision.CollisionLeft(Player, Controls))
         {
             foreach (PictureBox weapon in Controls)
             {
                 if ((string)weapon.Tag == "Weapon")
                 {
                     weapon.Left += PlayerSpeed;
                 }
             }
         }
     }
     foreach (PictureBox weapon in Controls)
     {
         if ((string)weapon.Tag == "Weapon" && !zasah)
         {
             foreach (PictureBox npc in Controls)
             {
                 if ((string)npc.Tag == "npc" && weapon.Bounds.IntersectsWith(npc.Bounds))
                 {
                     Zasah(npc);
                     zasah = true;
                 }
             }
         }
     }
 }