private void Czyszczenie(Rectangle[] Podstawka) { if (Podstawka.Length >= 10) { List<Int32> pod = new List<Int32> { }; List<Rectangle> indeksy = new List<Rectangle> { }; List<Int32> podliczby = new List<Int32> { }; foreach (var j in Enumerable.Range(0, 32)) { pod.Add(0); } foreach (var i in Podstawka) { if (i.Y < 0) { timer1.Enabled = false; MessageBox.Show("Game Over! Your score is " + score.ToString()); break; } else { pod[i.Y / 10]++; Console.WriteLine(pod[i.Y / 10]); } } foreach (var item in Enumerable.Range(0, 32)) { if (pod[item] == 10) { foreach (var k in Podstawka) { if (k.Y == item * 10) { indeksy.Add(k); } } } } if (indeksy.Count >= 10) { var nowa = Podstawka.ToList(); foreach (var l in indeksy) { if (Podstawka.Contains(l)) { nowa.Remove(l); Console.WriteLine(l); } if (!podliczby.Contains(l.Y)) { podliczby.Add(l.Y); } } Podstawka = nowa.ToArray(); podstawa.wszystko = Podstawka; foreach (var i in Enumerable.Range(0, Podstawka.Length)) { foreach (var item in podliczby) { if (Podstawka[i].Y < item) { Podstawka[i].Y += 10; } } } if (indeksy.Count == 40) { score += 1000; } else { score += indeksy.Count * 10; } Console.WriteLine(podstawa.wszystko.Length); label2.Text = score.ToString(); } } }