Ejemplo n.º 1
0
 private void Labirent_Load(object sender, EventArgs e)
 {
     LabirentOlustur();
     if (OyunModu == 2)
     {
         BilgisayarBekletme.Start();
     }
 }
Ejemplo n.º 2
0
        private void OtomatikHareketEt()
        {
            int kuzey = (int)dGVLabirent[FareXCurrent, FareYCurrent - 1].Tag;
            int guney = (int)dGVLabirent[FareXCurrent, FareYCurrent + 1].Tag;
            int bati  = (int)dGVLabirent[FareXCurrent - 1, FareYCurrent].Tag;
            int dogu  = (int)dGVLabirent[FareXCurrent + 1, FareYCurrent].Tag;

            if (kuzey <= guney && kuzey <= bati && kuzey <= dogu && kuzey != 999)
            {
                if ((int)dGVLabirent[FareXCurrent, FareYCurrent - 1].Tag == peynir)
                {
                    HamleSayisi += 1;
                    dGVLabirent[FareXCurrent, FareYCurrent].Value   = null;
                    dGVLabirent[FareXCurrent, FareYCurrent].Value   = Image.FromFile("yol.jpeg");
                    dGVLabirent[FareXCurrent, --FareYCurrent].Value = Image.FromFile("fare.png");
                    BilgisayarBekletme.Stop();
                    BilgisayarBekletme.Enabled = false;
                    MessageBox.Show("Peynir " + HamleSayisi + " hamlede bulundu."); AnaSayfa anaSayfa = new AnaSayfa();
                    anaSayfa.Show();
                    this.Hide();
                }
                else
                {
                    HamleSayisi += 1;
                    dGVLabirent[FareXCurrent, FareYCurrent].Value   = null;
                    dGVLabirent[FareXCurrent, FareYCurrent].Value   = Image.FromFile("yol.jpeg");
                    dGVLabirent[FareXCurrent, --FareYCurrent].Value = Image.FromFile("fare.png");
                    dGVLabirent[FareXCurrent, FareYCurrent].Tag     = (int)dGVLabirent[FareXCurrent, FareYCurrent].Tag + 1;
                }
            }
            else if (guney <= kuzey && guney <= bati && guney <= dogu && guney != 999)
            {
                if ((int)dGVLabirent[FareXCurrent, FareYCurrent + 1].Tag == peynir)
                {
                    HamleSayisi += 1;
                    dGVLabirent[FareXCurrent, FareYCurrent].Value   = null;
                    dGVLabirent[FareXCurrent, FareYCurrent].Value   = Image.FromFile("yol.jpeg");
                    dGVLabirent[FareXCurrent, ++FareYCurrent].Value = Image.FromFile("fare.png");
                    BilgisayarBekletme.Stop();
                    BilgisayarBekletme.Enabled = false;
                    MessageBox.Show("Peynir " + HamleSayisi + " hamlede bulundu."); AnaSayfa anaSayfa = new AnaSayfa();
                    anaSayfa.Show();
                    this.Hide();
                }
                else
                {
                    HamleSayisi += 1;
                    dGVLabirent[FareXCurrent, FareYCurrent].Value   = null;
                    dGVLabirent[FareXCurrent, FareYCurrent].Value   = Image.FromFile("yol.jpeg");
                    dGVLabirent[FareXCurrent, ++FareYCurrent].Value = Image.FromFile("fare.png");
                    dGVLabirent[FareXCurrent, FareYCurrent].Tag     = (int)dGVLabirent[FareXCurrent, FareYCurrent].Tag + 1;
                }
            }
            else if (bati <= guney && bati <= kuzey && bati <= dogu && bati != 999)
            {
                if ((int)dGVLabirent[FareXCurrent - 1, FareYCurrent].Tag == peynir)
                {
                    HamleSayisi += 1;
                    dGVLabirent[FareXCurrent, FareYCurrent].Value   = null;
                    dGVLabirent[FareXCurrent, FareYCurrent].Value   = Image.FromFile("yol.jpeg");
                    dGVLabirent[--FareXCurrent, FareYCurrent].Value = Image.FromFile("fare.png");
                    BilgisayarBekletme.Stop();
                    BilgisayarBekletme.Enabled = false;
                    MessageBox.Show("Peynir " + HamleSayisi + " hamlede bulundu."); AnaSayfa anaSayfa = new AnaSayfa();
                    anaSayfa.Show();
                    this.Hide();
                }
                else
                {
                    HamleSayisi += 1;
                    dGVLabirent[FareXCurrent, FareYCurrent].Value   = null;
                    dGVLabirent[FareXCurrent, FareYCurrent].Value   = Image.FromFile("yol.jpeg");
                    dGVLabirent[--FareXCurrent, FareYCurrent].Value = Image.FromFile("fare.png");
                    dGVLabirent[FareXCurrent, FareYCurrent].Tag     = (int)dGVLabirent[FareXCurrent, FareYCurrent].Tag + 1;
                }
            }
            else if (dogu <= guney && dogu <= bati && dogu <= kuzey && dogu != 999)
            {
                if ((int)dGVLabirent[FareXCurrent + 1, FareYCurrent].Tag == peynir)
                {
                    HamleSayisi += 1;
                    dGVLabirent[FareXCurrent, FareYCurrent].Value   = null;
                    dGVLabirent[FareXCurrent, FareYCurrent].Value   = Image.FromFile("yol.jpeg");
                    dGVLabirent[++FareXCurrent, FareYCurrent].Value = Image.FromFile("fare.png");
                    BilgisayarBekletme.Stop();
                    BilgisayarBekletme.Enabled = false;
                    MessageBox.Show("Peynir " + HamleSayisi + " hamlede bulundu."); AnaSayfa anaSayfa = new AnaSayfa();
                    anaSayfa.Show();
                    this.Hide();
                }
                else
                {
                    HamleSayisi += 1;
                    dGVLabirent[FareXCurrent, FareYCurrent].Value   = null;
                    dGVLabirent[FareXCurrent, FareYCurrent].Value   = Image.FromFile("yol.jpeg");
                    dGVLabirent[++FareXCurrent, FareYCurrent].Value = Image.FromFile("fare.png");
                    dGVLabirent[FareXCurrent, FareYCurrent].Tag     = (int)dGVLabirent[FareXCurrent, FareYCurrent].Tag + 1;
                }
            }
        }