using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int yer, x, y;
private void button1_Click(object sender, EventArgs e)
{
pictureBox2.Location= new Point(450,78);
Random rnd = new Random();
yer = rnd.Next(7, 12);
x = pictureBox2.Location.X;
y = pictureBox2.Location.Y;
timer1.Start();
}
int puan=0;
private void timer1_Tick(object sender, EventArgs e)
{
if (yer == 7)
{
x-=5;
if (x < 272)
{
label1.Text = "Toplam Puan...:"+(puan+=7);
timer1.Stop();
}
}
if (yer == 8)
{
x -= 5;
if (x < 245)
{
label1.Text = "Toplam Puan...:" + (puan += 8);
timer1.Stop();
}
}
if (yer == 9)
{
x -= 5;
if (x < 223)
{
label1.Text = "Toplam Puan...:" + (puan += 9);
timer1.Stop();
}
}
if (yer == 10)
{
x -= 5;
if (x < 200)
{
label1.Text = "Toplam Puan...:" + (puan += 10);
timer1.Stop();
}
}
if (yer == 11)
{
x -= 5;
if (x <182)
{
label1.Text = "Toplam Puan...:" + (puan += 11);
timer1.Stop();
}
}
if (yer == 12)
{
x -= 5;
if (x < 167)
{
label1.Text = "Toplam Puan...:" + (puan +=12);
timer1.Stop();
}
}
pictureBox2.Location =new Point(x, y);
}
}
}