Перечисление picturebox - C#
Формулировка задачи:
Листинг программы
- //money0
- if (player.Left + player.Width - 1 > money0.Left && player.Left + player.Width + 5 < money0.Left + money0.Width + player.Width)
- {
- if (player.Bottom - player.Height <= money0.Bottom && player.Bottom > money0.Bottom)
- {
- money0.Visible = false;
- hits = p+p;
- }
- }
- //money1
- if (player.Left + player.Width - 1 > money1.Left && player.Left + player.Width + 5 < money1.Left + money1.Width + player.Width)
- {
- if (player.Bottom - player.Height <= money1.Bottom && player.Bottom > money1.Bottom)
- {
- money1.Visible = false;
- hits += p;
- }
- }
Решение задачи: «Перечисление picturebox»
textual
Листинг программы
- foreach(var money in new []{ money1, money2 })
- {
- if (player.Left + player.Width - 1 > money.Left && player.Left + player.Width + 5 < money.Left + money.Width + player.Width)
- {
- if (player.Bottom - player.Height <= money.Bottom && player.Bottom > money.Bottom)
- {
- money.Visible = false;
- hits += p;
- }
- }
- }
ИИ поможет Вам:
- решить любую задачу по программированию
- объяснить код
- расставить комментарии в коде
- и т.д