using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Ex6
{
    public partial class Form1 : Form
    {
        int Score = 5;
        bool Bomb1 = false, Bomb2 = false, Bomb3 = false,Bomb4=false,Bomb5=false;
        public Form1()
        {
            InitializeComponent();
        }
        
        private void timer1_Tick(object sender, EventArgs e)
        {
            picMoshak1.Top = picMoshak1.Top + 2;
            picMoshak2.Top = picMoshak2.Top + 2;
            picMoshak3.Top = picMoshak3.Top + 2;
            picMoshak4.Top = picMoshak4.Top + 2;
            picMoshak5.Top = picMoshak5.Top + 2;
            picMoshak1.Left = picMoshak1.Left - 5;
            picMoshak2.Left = picMoshak2.Left - 5;
            picMoshak3.Left = picMoshak3.Left - 5;
            picMoshak4.Left = picMoshak4.Left - 5;
            picMoshak5.Left = picMoshak5.Left - 5;
            //**************************************************
            if (picMoshak1.Left <=0 && !Bomb1)
            {
                this.Text = "Score:=" + (++Score);
                picMoshak1.Left = this.Width;
            }
            if (picMoshak2.Left <= 0 && !Bomb2)
            {
                this.Text = "Score:=" + (++Score);
                picMoshak2.Left = this.Width;
            }
            if (picMoshak3.Left <= 0 && !Bomb3)
            {
                this.Text = "Score:=" + (++Score);
                picMoshak3.Left = this.Width;
            }
            if (picMoshak4.Left <= 0 && !Bomb4)
            {
                this.Text = "Score:=" + (++Score);
                picMoshak4.Left = this.Width;
            }
            if (picMoshak5.Left <= 0 && !Bomb5)
            {
                this.Text = "Score:=" + (++Score);
                picMoshak5.Left = this.Width;
            }

            if (picMoshak1.Top + picMoshak1.Height >= Road.Top && !Bomb1)
            {
                this.Text = "Score:=" + (--Score);
                Bomb1 = true;
                picMoshak1.Visible = false;
            }
            if (picMoshak2.Top + picMoshak2.Height >= Road.Top && !Bomb2)
            {
                this.Text = "Score:=" + (--Score);
                Bomb2 = true;
                picMoshak2.Visible = false;
            }
            if (picMoshak3.Top + picMoshak3.Height >= Road.Top && !Bomb3)
            {
                this.Text = "Score:=" + (--Score);
                Bomb3 = true;
                picMoshak3.Visible = false;
            }
            if (picMoshak4.Top + picMoshak4.Height >= Road.Top && !Bomb4)
            {
                this.Text = "Score:=" + (--Score);
                Bomb4 = true;
                picMoshak4.Visible = false;
            }
            if (picMoshak5.Top + picMoshak5.Height >= Road.Top && !Bomb5)
            {
                this.Text = "Score:=" + (--Score);
                Bomb5 = true;
                picMoshak5.Visible = false;
            }
        }

        private void picMoshak1_Click(object sender, EventArgs e)
        {
            picMoshak1.Top = picMoshak1.Top - 10;
        }

        private void picMoshak2_Click(object sender, EventArgs e)
        {
            picMoshak2.Top = picMoshak2.Top - 10;
        }

        private void picMoshak3_Click(object sender, EventArgs e)
        {
            picMoshak3.Top = picMoshak3.Top - 10;
        }

        private void picMoshak5_Click(object sender, EventArgs e)
        {
            picMoshak5.Top = picMoshak5.Top - 10;
        }

        private void picMoshak4_Click(object sender, EventArgs e)
        {
            picMoshak4.Top = picMoshak4.Top - 10;
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            this.Text = "Score:=" + Score;
        }
    }
}
