예제 #1
0
 private void Form1_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Up || e.KeyCode == Keys.W)
     {
         if (yonumuz._y != 10)
         {
             yonumuz = new yon(0, -10);
         }
     }
     else if (e.KeyCode == Keys.Down || e.KeyCode == Keys.S)
     {
         if (yonumuz._y != -10)
         {
             yonumuz = new yon(0, 10);
         }
     }
     else if (e.KeyCode == Keys.Left || e.KeyCode == Keys.A)
     {
         if (yonumuz._x != 10)
         {
             yonumuz = new yon(-10, 0);
         }
     }
     else if (e.KeyCode == Keys.Right || e.KeyCode == Keys.D)
     {
         if (yonumuz._x != -10)
         {
             yonumuz = new yon(10, -0);
         }
     }
 }
예제 #2
0
 private void yeni_oyun()
 {
     yem_kontrol = false;
     skor        = 0;
     yilanimiz   = new yilan();
     yonumuz     = new yon(-10, 0);
     pb_parca    = new PictureBox[0];
     for (int i = 0; i < 3; i++)
     {
         Array.Resize(ref pb_parca, pb_parca.Length + 1);
         pb_parca[i] = pb_ekle();
     }
     timer1.Start();
     button1.Enabled = false;
 }
예제 #3
0
 public void ilerle(yon yon)
 {
     yonumuz = yon;
     if (yon._x == 0 && yon._y == 0)
     {
     }
     else
     {
         for (int i = yilan_parca.Length - 1; i > 0; i--)
         {
             yilan_parca[i] = new parca(yilan_parca[i - 1].x_, yilan_parca[i - 1].y_);
         }
         yilan_parca[0] = new parca(yilan_parca[0].x_ + yon._x, yilan_parca[0].y_ + yon._y);
     }
 }