﻿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 buba
{
    public partial class Form1 : Form
    {
        public int poena;
        public Form1()
        {
            InitializeComponent();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            pictureBox1.Top += 10;
            if (pictureBox1.Bottom > this.Height)

                pictureBox1.Top = 0;

            if (pictureBox2.Visible == true)
            {
                pictureBox2.Top += 10;

                pictureBox2.Top += 10;
                if (pictureBox2.Bottom > this.Height)

                    pictureBox2.Top = 0;
            }

            if (pictureBox3.Visible == true)
            {
                pictureBox3.Top += 10;

                pictureBox3.Top += 10;
                if (pictureBox3.Bottom > this.Height)

                    pictureBox3.Top = 0;
            }

            if (pictureBox4.Visible == true)
            {
                pictureBox4.Top += 10;

                pictureBox4.Top += 10;
                if (pictureBox4.Bottom > this.Height)

                    pictureBox4.Top = 0;
            }
            if (pictureBox5.Visible == true)
            {
                pictureBox5.Top += 10;

                pictureBox5.Top += 10;
                if (pictureBox5.Bottom > this.Height)

                    pictureBox5.Top = 0;
            }
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {
            poena += 10;
            label2.Text = Convert.ToString(poena);
            Random R = new Random();
            var opseg = this.Size - pictureBox1.Size;
            var pozicijax = R.Next(0, opseg.Width);
            pictureBox1.Location = new Point(pozicijax, 0);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void pictureBox2_Click(object sender, EventArgs e)
        {
            poena += 10;
            label2.Text = Convert.ToString(poena);
            Random R = new Random();
            var opseg = this.Size - pictureBox2.Size;
            var pozicijax = R.Next(0, opseg.Width);
            pictureBox2.Location = new Point(pozicijax, 0);
        }

        private void pictureBox3_Click(object sender, EventArgs e)
        {
            poena += 10;
            label2.Text = Convert.ToString(poena);
            Random R = new Random();
            var opseg = this.Size - pictureBox3.Size;
            var pozicijax = R.Next(0, opseg.Width);
            pictureBox3.Location = new Point(pozicijax, 0);
        }

        private void pictureBox4_Click(object sender, EventArgs e)
        {
            poena += 10;
            label2.Text = Convert.ToString(poena);
            Random R = new Random();
            var opseg = this.Size - pictureBox4.Size;
            var pozicijax = R.Next(0, opseg.Width);
            pictureBox4.Location = new Point(pozicijax, 0);
        }

        private void pictureBox5_Click(object sender, EventArgs e)
        {
            poena += 10;
            label2.Text = Convert.ToString(poena);
            Random R = new Random();
            var opseg = this.Size - pictureBox5.Size;
            var pozicijax = R.Next(0, opseg.Width);
            pictureBox5.Location = new Point(pozicijax, 0);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            if (pictureBox2.Visible == false)
                pictureBox2.Show();
            else if
                (pictureBox3.Visible == false)
                pictureBox3.Show();
            else if
              (pictureBox4.Visible == false)
                pictureBox4.Show();
            else if
              (pictureBox5.Visible == false)
                pictureBox5.Show();
        }
    }
}
