HTML:
	
	namespace xball
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        int level = 1, kutusayısı = 10;
        ArrayList kutucuklar = new ArrayList();
        int yerX = 5, yerY = 5, hak = 3;
     
        private void Form1_Load(object sender, EventArgs e)
        {
            this.Text = "kalan hak=" + hak.ToString() + "level= " + level.ToString();
            yenile();
            kutucukolustur();
        }
        private void Form1_MouseMove(object sender, MouseEventArgs e)
        {
            pictureBox1.Left = e.X;
        }
        private void kutucukolustur()
        {
            for (int j = 0; j < level; j++)
            {
                for (int i = 0; i < 10; i++)
                {
                    PictureBox btn = new PictureBox();
                    if (level == 1)
                        btn.ImageLocation = "1.png";
                    else if (level == 2)
                        btn.ImageLocation = "2.png";
                    else if (level == 3)
                        btn.ImageLocation = "3.png";
                    btn.Name = i.ToString();
                    btn.SizeMode = PictureBoxSizeMode.StretchImage;
                    btn.Size = new Size(70, 65);
                    btn.Location = new Point(20 + i * 120, j * 90 + 20);
                    btn.BackColor = Color.Transparent;
                    this.Controls.Add(btn);
                    kutucuklar.Add(btn);
                }
            }
        }
        private void ballhareket()
        {
            if (this.ClientSize.Width <= pictureBox2.Right)
                yerX = yerX * -1;
            else if (0 >= pictureBox2.Left)
                yerX = yerX * -1;
            if (this.ClientSize.Height <= pictureBox2.Bottom)
                yerY = yerY * -1;
            else if (0 >= pictureBox2.Top)
                yerY = yerY * -1;
            else if (pictureBox2.Bottom >= pictureBox1.Top && pictureBox2.Right >= pictureBox1.Left && pictureBox2.Left <= pictureBox1.Right)
                yerY = yerY * -1;
            pictureBox2.Location = new Point(pictureBox2.Left + yerX, pictureBox2.Top + yerY);
        }
        private void yenile()
        {
            kutusayısı = 10 * level;
            Random rnd = new Random();
            int x = rnd.Next(0, 50);
            int y = rnd.Next(300, 350);
            pictureBox2.Location = new Point(x, y);
            timer1.Enabled = true;
            timer1.Interval = 5;
            yerX = 1 + level * 1;
            yerY = -1 - level * 1;
        }
        private void carpmadenetimi()
        {
            Rectangle r = new Rectangle();
            Rectangle t = new Rectangle();
            t.X = pictureBox2.Left;
            t.Y = pictureBox2.Top;
            t.Height = pictureBox2.Height;
            t.Width = pictureBox2.Width;
            for (int i = 0; i < kutucuklar.Count; i++)
            {
                PictureBox btn = ((PictureBox)kutucuklar[i]);
                r.X = btn.Left;
                r.Y = btn.Top;
                r.Height = btn.Height;
                r.Width = btn.Width;
                if (r.IntersectsWith(t))
                {
                    kutusayısı--;
                    kutucuklar.RemoveAt(i);
                    if (yerY > 0 && yerX > 0)
                    {
                        if (btn.Top <= pictureBox2.Bottom && btn.Left < pictureBox2.Right)
                            yerY = yerY * -1;
                        else
                            yerX = yerX * -1;
                    }
                    else
                        if (yerY > 0 && yerX < 0)
                        {
                            if (btn.Top <= pictureBox2.Bottom && btn.Right > pictureBox2.Left)
                                yerY = yerY * -1;
                            else
                                yerX = yerX * -1;
                        }
                        else
                            if (yerY < 0 && yerX > 0)
                            {
                                if (btn.Bottom >= pictureBox2.Top && btn.Left < pictureBox2.Right)
                                    yerY = yerY * -1;
                                else
                                    yerX = yerX * -1;
                            }
                            else
                                if (yerY < 0 && yerX < 0)
                                {
                                    if (btn.Bottom >= pictureBox2.Top && btn.Right > pictureBox2.Left)
                                        yerY = yerY * -1;
                                    else
                                        yerX = yerX * -1;
                                }
                    btn.Dispose();
                }
            }
        }
        private void kalanhak(object sender, EventArgs e)
        {
            if (pictureBox2.Bottom > pictureBox1.Bottom &&!(pictureBox2.Right >= pictureBox1.Left && pictureBox2.Left <= pictureBox1.Right))
            {
                hak--;
                for (int i = 0; i < kutucuklar.Count; i++)
                {
                    PictureBox btn = ((PictureBox)kutucuklar[i]);
                    ((PictureBox)kutucuklar[i]).Dispose();
                }
                kutucuklar.Clear();
                timer1.Enabled = false;
                DialogResult dr = DialogResult.None;
                if (hak > 0)
                {
                    dr = MessageBox.Show("yandınız kalan hakkınız =" + hak.ToString());
                    if (dr == DialogResult.OK)
                        Form1_Load(sender, e);
                }
                else if (hak == 0)
                {
                    MessageBox.Show("game over");
                    this.Close();
                }
            }
        }
        private void oyunbittimi(object sender, EventArgs e)
        {
            DialogResult dr = DialogResult.None;
            if(kutusayısı == 0)
            {
              timer1.Enabled =false;
                dr = MessageBox.Show("tebrikler seviye ="+level+"bitirdiniz");
                level++;
            }
            if (dr == DialogResult.OK)
                Form1_Load(sender,e);
        }
        private void timer1_Tick(object sender, EventArgs e)
        {
            ballhareket();
            carpmadenetimi();
            kalanhak(sender, e);
            oyunbittimi(sender, e);
        }
    }
}--- Gönderi Güncellendi ---
projem ; Dosya.tc - Ücretsiz, Hızlı ve Kolay Dosya Paylaşımı
 
					
				
 
 
		 
 
		 
 
		