Archive for March 2008


Engellere Çarpmama Oyunu

March 27th, 2008 — 9:58pm

Bu oyunda klavyedeki yön tuşları ile hareket eden cisimlere çarpmadan en yukarı
çıkmaya çalışıyoruz. En sona gelirsek yeni açılan formda kazandınız yazıyor. Eğer
bir engele çarparsak açılan formda kaybettiniz yazıyor.

Eğitsel Oyun, C#

Visual Studio 2005 ile yapıldı. (c# 2.0 ımsı)
Kodları indirmek için Tıklayınız

Form Nesnesindeki Kodlar

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
 
namespace _1021042___proje_28_nisan
{
public partial class Form1 : Form
{
int durum1, durum2, durum3, durum4 = 0;
int sol1 = 270;
int sol2 = 100;
int sol3 = 250;
int sol4 = 280;
 
public Form1()
{
    InitializeComponent();
}
 
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
if (panel1.Top < 80)
{
    Form2 frm2 = new Form2();
    Form1 frm1 = new Form1();
    Label yazi = new Label();
    frm2.Show();
    frm2.Controls.Add(yazi);
    yazi.Text = "Kazandınız";
    yazi.Font = new Font("Microsoft Sans Serif",
                   15.75F, FontStyle.Regular);
    yazi.Location = new Point(100, 100);
    yazi.AutoSize = true;
}
 
if (e.KeyCode == Keys.Left)
{
    if (panel1.Left <= 100)
    panel1.Left = 100;
    else if (panel1.Left != 100)
    panel1.Left = panel1.Left - 4;
}
 
if (e.KeyCode == Keys.Right)
{
    if (panel1.Left >= 400)
    panel1.Left = 400;
    else if (panel1.Left != 400)
    panel1.Left = panel1.Left + 4;
}
 
if (e.KeyCode == Keys.Up)
{
    if (panel1.Top <= 0)
        panel1.Top = 0;
    else if (panel1.Top != 0)
        panel1.Top = panel1.Top - 4;
}
 
if (e.KeyCode == Keys.Down)
{
    if (panel1.Top >= 350)
        panel1.Top = 350;
    else if (panel1.Top != 350)
        panel1.Top = panel1.Top + 4;
}
}
 
private void timer1_Tick(object sender, EventArgs e)
{
    if (durum1 == 1)
        sol1 += 5;
    else
        sol1 -= 3;
 
    if (sol1 < 100)
        durum1 = 1;
 
    if (sol1 > 320)
        durum1 = 2;
 
    panel4.Location = new Point(sol1, 100);
 
    if (panel1.Left > panel4.Left & panel1.Left < panel4.Left + 80)
    {
        if (panel1.Top < panel4.Top + 20 & panel1.Top > panel4.Top)
        {
            timer1.Enabled = false;
            Form2 frm2 = new Form2();
            Form1 frm1 = new Form1();
            Label yazi = new Label();
            frm2.Show();
            frm2.Controls.Add(yazi);
            yazi.Text = "Kaybettiniz";
            yazi.Font = new Font("Microsoft Sans Serif",
                           15.75F, FontStyle.Regular);
            yazi.Location = new Point(100, 100);
            yazi.AutoSize = true;
        }
    }
}
 
private void timer2_Tick(object sender, EventArgs e)
{
    if (durum2 == 1)
        sol2 += 5;
    else
        sol2 -= 5;
 
    if (sol2 < 100)
        durum2 = 1;
 
    if (sol2 > 320)
        durum2 = 2;
 
    panel5.Location = new Point(sol2, 162);
 
    if (panel1.Left > panel5.Left & panel1.Left < panel5.Left + 80)
    {
        if (panel1.Top < panel5.Top + 20 & panel1.Top > panel5.Top)
        {
            timer2.Enabled = false;
            Form2 frm2 = new Form2();
            Form1 frm1 = new Form1();
            Label yazi = new Label();
            frm2.Show();
            frm2.Controls.Add(yazi);
            yazi.Text = "Kaybettiniz";
            yazi.Font = new Font("Microsoft Sans Serif",
                          15.75F, FontStyle.Regular);
            yazi.Location = new Point(100, 100);
            yazi.AutoSize = true;
        }
    }
}
 
private void timer3_Tick(object sender, EventArgs e)
{
    if (durum3 == 1)
        sol3 += 7;
    else
        sol3 -= 7;
 
    if (sol3 < 100)
        durum3 = 1;
 
    if (sol3 > 320)
        durum3 = 2;
 
    panel6.Location = new Point(sol3, 224);
 
    if (panel1.Left > panel6.Left & panel1.Left < panel6.Left + 80)
    {
        if (panel1.Top < panel6.Top + 20 & panel1.Top > panel6.Top)
        {
            timer3.Enabled = false;
            Form2 frm2 = new Form2();
            Form1 frm1 = new Form1();
            Label yazi = new Label();
            frm2.Show();
            frm2.Controls.Add(yazi);
            yazi.Text = "Kaybettiniz";
            yazi.Font = new Font("Microsoft Sans Serif",
                            15.75F, FontStyle.Regular);
            yazi.Location = new Point(100, 100);
            yazi.AutoSize = true;
        }
    }
}
 
private void timer4_Tick(object sender, EventArgs e)
{
    if (durum4 == 1)
        sol4 += 5;
    else
        sol4 -= 5;
 
    if (sol4 < 100)
        durum4 = 1;
 
    if (sol4 > 320)
        durum4 = 2;
 
    panel7.Location = new Point(sol4, 286);
 
    if (panel1.Left > panel7.Left & panel1.Left < panel7.Left+80)
    {
        if (panel1.Top < panel7.Top + 20 & panel1.Top >panel7.Top)
        {
            timer4.Enabled = false;
            Form2 frm2 = new Form2();
            Form1 frm1 = new Form1();
            Label yazi = new Label();
            frm2.Show();
            frm2.Controls.Add(yazi);
            yazi.Text = "Kaybettiniz";
            yazi.Font = new Font("Microsoft Sans Serif",
                         15.75F, FontStyle.Regular);
            yazi.Location = new Point(100, 100);
            yazi.AutoSize = true;
        }
    }
}
}
}

Comment » | Csharp - C#

Gezegen Yerleştirmece Oyunu

March 27th, 2008 — 9:48pm

ilk öğretim 4. veya 5. sınıf öğrencilerine gezegenlerin yörüngelerini öğretmek amacıyla
yazılmış bir uygulama. Ödev olarak hazırlamıştım. ben ödevi yaparken internetten
pek bişey bulamıyordum. Böte’daş larım faydalansın.

Bi gün bi google aramasından çıkar.

Eğitsel Oyun Yazılımları

Visual Studio 2005 de hazırlanmıştır. (c# 2.0 ımsı)

Kodları İndirmek İçin Tıklayınız

Form Nesnesindeki Kodlar

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Data.OleDb;
using System.Data.ProviderBase;
using System.Data.Sql;
 
namespace dragdrop
{
public partial class Form1 : Form
{
    private mousehareket mhrkt;
    private databaseislemleri dbi;
 
    string dunyaisim = "dunya";
    string merkurisim = "merkur";
    string marsisim = "mars";
    string venusisim = "venus";
    string jupiterisim = "jupiter";
    string saturnisim = "saturn";
    string uranusisim = "uranus";
    string neptunisim = "neptun";
    string plutonisim = "pluton";
 
    int suredegisken = 0;
    int puandegisken = 1000;
    int dogruadedi = 0;
 
    private void Form1_Load(object sender, EventArgs e)
    {
        mhrkt = new mousehareket(timer1);
        dbi = new databaseislemleri();
 
    #region mousedown eventlar
 
        merkur.MouseDown += new MouseEventHandler(drag_yapilacak_MouseDown);
        venus.MouseDown += new MouseEventHandler(drag_yapilacak_MouseDown);
        dunya.MouseDown += new MouseEventHandler(drag_yapilacak_MouseDown);
        mars.MouseDown += new MouseEventHandler(drag_yapilacak_MouseDown);
        jupiter.MouseDown += new MouseEventHandler(drag_yapilacak_MouseDown);
        saturn.MouseDown += new MouseEventHandler(drag_yapilacak_MouseDown);
        uranus.MouseDown += new MouseEventHandler(drag_yapilacak_MouseDown);
        neptun.MouseDown += new MouseEventHandler(drag_yapilacak_MouseDown);
        pluton.MouseDown += new MouseEventHandler(drag_yapilacak_MouseDown);
 
    #endregion
 
    #region mouseup eventlar
 
        merkur.MouseUp += new MouseEventHandler(drag_yapilacak_MouseUp);
        venus.MouseUp += new MouseEventHandler(drag_yapilacak_MouseUp);
        dunya.MouseUp += new MouseEventHandler(drag_yapilacak_MouseUp);
        mars.MouseUp += new MouseEventHandler(drag_yapilacak_MouseUp);
        jupiter.MouseUp += new MouseEventHandler(drag_yapilacak_MouseUp);
        saturn.MouseUp += new MouseEventHandler(drag_yapilacak_MouseUp);
        uranus.MouseUp += new MouseEventHandler(drag_yapilacak_MouseUp);
        neptun.MouseUp += new MouseEventHandler(drag_yapilacak_MouseUp);
        pluton.MouseUp += new MouseEventHandler(drag_yapilacak_MouseUp);
 
    #endregion
 
    #region mousemove eventlar
 
        merkur.MouseMove += new MouseEventHandler(drag_yapilacak_MouseMove);
        venus.MouseMove += new MouseEventHandler(drag_yapilacak_MouseMove);
        dunya.MouseMove += new MouseEventHandler(drag_yapilacak_MouseMove);
        mars.MouseMove += new MouseEventHandler(drag_yapilacak_MouseMove);
        jupiter.MouseMove += new MouseEventHandler(drag_yapilacak_MouseMove);
        saturn.MouseMove += new MouseEventHandler(drag_yapilacak_MouseMove);
        uranus.MouseMove += new MouseEventHandler(drag_yapilacak_MouseMove);
        neptun.MouseMove += new MouseEventHandler(drag_yapilacak_MouseMove);
        pluton.MouseMove += new MouseEventHandler(drag_yapilacak_MouseMove);
 
    #endregion
 
    #region gezegen pozisyonları
 
        dunya.Location = new Point(623, 466);
        merkur.Location = new Point(100, 460);
        mars.Location = new Point(560, 455);
        venus.Location = new Point(355, 485);
        uranus.Location = new Point(260, 445);
        jupiter.Location = new Point(710, 430);
        saturn.Location = new Point(135, 470);
        pluton.Location = new Point(430, 455);
        neptun.Location = new Point(470, 455);
 
    #endregion
 
    }
 
    private void gezegen_yeri_konrol(int x, int y, string isim)
    {
    if (isim == dunyaisim)
    {
        if ((x > 415) && (x < 425))         {             if ((y > 185) && (y < 205))             {                 dunya_txt.Visible = true;                 dunya.Enabled = false;                 dogruadedi++;             }         }         else         {             uyari.Text = "Dünya, üzerinde yaşam olan tek gezegendir...";         }     }     if (isim == merkurisim)     {     if ((x > 290) && (x < 320))     {         if ((y > 120) && (y < 150))         {             merkur_txt.Visible = true;             merkur.Enabled = false;             dogruadedi++;         }         }         else         {             uyari.Text = "Merkür, güneşe en yakın gezegendir...";         }     }     if (isim == venusisim)     {         if ((x > 335) && (x < 350))         {             if ((y > 155) && (y < 175))             {                 venus_txt.Visible = true;                 venus.Enabled = false;                 dogruadedi++;             }         }         else         {             uyari.Text = "Venüs, gökyüzündeki                      güneş ve ay'dan sonra en parlak cisimdir...";         }     }     if (isim == marsisim)     {     if ((x > 505) && (x < 530))     {         if ((y > 215) && (y < 235))         {             mars_txt.Visible = true;             mars.Enabled = false;             dogruadedi++;         }         }         else         {             uyari.Text = "Mars, kırmızı gezegen olarak bilinir...";         }     }     if (isim == jupiterisim)     {         if ((x > 610) && (x < 630))         {             if ((y > 180) && (y < 225))             {                 jupiter_txt.Visible = true;                 jupiter.Enabled = false;                 dogruadedi++;             }         }         else         {             uyari.Text = "Jupiter, güneş sisteminin en büyük gezegenidir...";         }     }     if (isim == saturnisim)     {         if ((x > 715) && (x < 745))         {             if ((y > 185) && (y < 215))             {                 saturn_txt.Visible = true;                 saturn.Enabled = false;                 dogruadedi++;             }         }         else         {             uyari.Text = "Saturn, halka sistemine sahiptir...";         }     }     if (isim == uranusisim)     {         if ((x > 785) && (x < 830))         {             if ((y > 145) && (y < 170))             {                 uranus_txt.Visible = true;                 uranus.Enabled = false;                 dogruadedi++;             }         }         else         {             uyari.Text = "Uranus, atmosferindeki az miktarda metan                                   gezegene mavi-yeşil rengini verir...";         }     }     if (isim == neptunisim)     {         if ((x > 775) && (x < 810))         {             if ((y > 55) && (y < 80))             {                 neptun_txt.Visible = true;                 neptun.Enabled = false;                 dogruadedi++;             }         }         else         {             uyari.Text = "Neptün, bir gaz devidir...";         }     }     if (isim == plutonisim)     {         if ((x > 710) && (x < 745))         {             if ((y > 5) && (y < 40))
            {
                pluton_txt.Visible = true;
                pluton.Enabled = false;
                dogruadedi++;
            }
            }
            else
            {
                uyari.Text = "Pluton, en küçük gezegendir...";
            }
        }
    }
 
    private void oyun_bitisi()
    {
        if (dogruadedi == 9)
        {
            timer2.Enabled = false;
            uyari.Text = "Bravo, hepsini doğru yerleştirdin...";
            panel2.Visible = true;
 
            dbi.puan = int.Parse(puan.Text);
 
            dbi.puan_yaz();
        }
    }
 
    private void timer1_Tick(object sender, EventArgs e)
    {
        mhrkt.yeniyere();
    }
 
    private void drag_yapilacak_MouseDown(object sender,
                    System.Windows.Forms.MouseEventArgs e)
    {
        Control k = (Control)sender;
 
        if (e.Button == MouseButtons.Left)
        {
            mhrkt.basla(k,e.X, e.Y);
        }
    }
 
    private void drag_yapilacak_MouseUp(object sender,
                 System.Windows.Forms.MouseEventArgs e)
    {
        if (e.Button == MouseButtons.Left)
        {
            mhrkt.bitir();
        }
 
        Control k = (Control)sender;
 
        gezegen_yeri_konrol(k.Left, k.Top, k.Name);
        oyun_bitisi();
    }
 
    private void drag_yapilacak_MouseMove(object sender,
                      System.Windows.Forms.MouseEventArgs e)
    {
        if (e.Button == MouseButtons.Left)
        {
        mhrkt.islem(e.X, e.Y);
        }
    } 
 
    private void kapatToolStripMenuItem_Click(object sender, EventArgs e)
    {
        Application.Exit();
    }
 
    private void yeniOyunToolStripMenuItem_Click(object sender, EventArgs e)
    {
        dunya.Location= new Point(623,466);
        merkur.Location = new Point(100, 460);
        mars.Location=new Point(560,455);
        venus.Location= new Point(355,485);
        uranus.Location = new Point(260, 445);
        jupiter.Location= new Point(710,430);
        saturn.Location = new Point(135, 470);
        pluton.Location= new Point(430,455);
        neptun.Location = new Point(470, 455);
 
        dunya.Enabled = true;
        merkur.Enabled = true;
        mars.Enabled = true;
        venus.Enabled = true;
        uranus.Enabled = true;
        jupiter.Enabled = true;
        saturn.Enabled = true;
        pluton.Enabled = true;
        neptun.Enabled = true;
 
        dunya_txt.Visible = false;
        merkur_txt.Visible = false;
        mars_txt.Visible = false;
        venus_txt.Visible = false;
        uranus_txt.Visible = false;
        jupiter_txt.Visible = false;
        saturn_txt.Visible = false;
        pluton_txt.Visible = false;
        neptun_txt.Visible = false;
 
        suredegisken = 0;
        puandegisken = 1000;
        dogruadedi = 0;
 
        panel2.Visible = false;
 
        timer2.Enabled = true;
 
    }
 
    private void timer2_Tick(object sender, EventArgs e)
    {
 
        puandegisken = puandegisken - 5;
        puan.Text = puandegisken.ToString();
 
        suredegisken++;
        sure.Text = suredegisken.ToString();
    }
 
    private void enYüksekPuanToolStripMenuItem_Click(object sender, EventArgs e)
    {
        dbi.en_yuksek();
    }
 
    private void flashAnlatımToolStripMenuItem_Click(object sender, EventArgs e)
    {
        Process Proc = new Process();
        Proc.StartInfo.FileName = "anlatim.exe";
        Proc.Start();
    }
 
    private void oyunHakkındaToolStripMenuItem_Click(object sender, EventArgs e)
    {
        panel1.Visible = true;
    }
 
    private void button1_Click(object sender, EventArgs e)
    {
        panel1.Visible = false;
    }
 
    }
}

Comment » | E-Learning

Kızma Biraderimsi Sponge Bob ve Patrik Oyunu

March 27th, 2008 — 9:24pm

Buda ödev olarak yaptığım bi oyun. Sponge Bob ve Patrik için 2 ayrı düğme var. Basıyosun
gelen rasgele zar sayısını otomatik ilerliyolar. Önce bitiren kazanıyo.

Eğitsel Oyun, C#

Visual Studio 2005 ile yapıldı. (c# 2.0 ımsı)
Kodları indirmek için Tıklayınız

Form Nesnesindeki Kodlar

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
 
namespace ödev_1
{
public partial class Form1 : Form
{
    int i, n, m, a, b, c = 0;
    int[] zarrr = new int[6] { 1, 2, 3, 4, 5, 6 };
 
    public Form1()
    {
        InitializeComponent();
    }
 
    private void button1_Click(object sender, EventArgs e)
    {
        //Rastgele Bir Zar Görüntülemek İçin
        Random zar = new Random();
        int zarr=zar.Next(6);
 
        //zarın koşulları
        if (zarrr[zarr] == 1)
        {
            // zar sonucunun resmini görüntülemek için
            pictureBox1.Visible=true;
            pictureBox4.Visible=false;
            pictureBox6.Visible=false;
            pictureBox7.Visible=false;
            pictureBox8.Visible=false;
            pictureBox9.Visible=false;
            // zar resminin altındaki sayıyı yazmak için
            label2.Text = "1";
            // ilerlenilen toplam kare sayısı
            a = a + 1;
        }
        else if (zarrr[zarr] == 2)
        {
            // zar sonucunun resmini görüntülemek için
            pictureBox1.Visible = false;
            pictureBox4.Visible = true;
            pictureBox6.Visible=false;
            pictureBox7.Visible=false;
            pictureBox8.Visible=false;
            pictureBox9.Visible=false;
            // zar resminin altındaki sayıyı yazmak için
            label2.Text = "2";
            // ilerlenilen toplam kare sayısı
            a = a + 2;
        }
        else if (zarrr[zarr] == 3)
        {
            // zar sonucunun resmini görüntülemek için
            pictureBox1.Visible = false;
            pictureBox4.Visible=false;
            pictureBox6.Visible = false;
            pictureBox7.Visible=false;
            pictureBox8.Visible=false;
            pictureBox9.Visible=true;
            // zar resminin altındaki sayıyı yazmak için
            label2.Text = "3";
            // ilerlenilen toplam kare sayısı
            a = a + 3;
        }
        else if (zarrr[zarr] == 4)
        {
            // zar sonucunun resmini görüntülemek için
            pictureBox1.Visible = false;
            pictureBox4.Visible=false;
            pictureBox6.Visible=false;
            pictureBox7.Visible =false ;
            pictureBox8.Visible=true;
            pictureBox9.Visible=false;
            // zar resminin altındaki sayıyı yazmak için
            label2.Text = "4";
            // ilerlenilen toplam kare sayısı
            a = a + 4;
        }
        else if (zarrr[zarr] == 5)
        {
            // zar sonucunun resmini görüntülemek için
            pictureBox1.Visible = false;
            pictureBox4.Visible=false;
            pictureBox6.Visible=false;
            pictureBox7.Visible=true;
            pictureBox8.Visible = false;
            pictureBox9.Visible=false;
            // zar resminin altındaki sayıyı yazmak için
            label2.Text = "5";
            // ilerlenilen toplam kare sayısı
            a = a + 5;
        }
        else if (zarrr[zarr] == 6)
        {
            // zar sonucunun resmini görüntülemek için
            pictureBox1.Visible = false;
            pictureBox4.Visible = false;
            pictureBox6.Visible = true;
            pictureBox7.Visible = false;
            pictureBox8.Visible = false;
            pictureBox9.Visible = false;
            // zar resminin altındaki sayıyı yazmak için
            label2.Text = "6";
            // ilerlenilen toplam kare sayısı
            a = a + 6;
        }
 
        //sponge bob'ın kaç kare gittiğini göstermek için
        //skorbord
        label6.Text = a.ToString();
 
        //piyonun ilerlemesini sağlayan koşul
        i = a;
        //oyunun kazanıldığının uyarılması
        if (a >= 80)
        {
            MessageBox.Show("Sponge Bob Kazandı! "
                                + label7.Text + " / " + label6.Text);
            //piyonların ortaya gelmesi
            pictureBox5.Location = new Point(375, 290);
            pictureBox11.Location = new Point(375, 270);
            //zar atma butonlarının kapatılması
            button1.Enabled = false;
            button2.Enabled = false;
            //oyuna başlama butonunun tekrar aktif olması
            button3.Enabled = true;
            // skorboardun sıfırlanması
            a = 0;
            c = 0;
            label6.Text = a.ToString();
            label7.Text = c.ToString();
        }
        else if (i >74)
        {
            n = 30;
            m = 355;
            b = i - 74;
            pictureBox5.Location = new Point(n, m - (b * 50));
        }
        else if (i >61)
        {
            n = 680;
            m = 355;
            b = i - 61;
            pictureBox5.Location = new Point(n - (b * 50), m);
        }
        else if (i >55)
        {
            n = 730;
            m = 55;
            b = i - 55;
            pictureBox5.Location = new Point(n, m + (b * 50));
        }
        else if (i > 40)
        {
            n = 30;
            m = 55;
            b = i - 40;
            pictureBox5.Location = new Point(n + (b * 50), m);
        }
        else if (i>34)
        {
            n = 30;
            m = 355;
            b = i - 34;
            pictureBox5.Location = new Point(n, m - (b * 50));
        }
        else if (i >20)
        {
            n = 680;
            m = 355;
            b = i - 21;
            pictureBox5.Location = new Point(n - (b * 50), m);
        }
        else if(i >14)
        {
            n = 730;
            m = 55;
            b = i - 14;
            pictureBox5.Location = new Point(n, m + (b * 50));
        }
        else
        {
            n = 30;
            m = 55;
            pictureBox5.Location = new Point(n + (i * 50), m);
        }
 
        //zar atma sırası öbür oyuncuda mı?
        if (a == 6 | a == 18 | a == 23 | a == 46 | a == 59 | a == 63)
        {
            MessageBox.Show("dadadada bir kere daha zar at");
        }
        else
        {
            button1.Enabled = false;
            button2.Enabled = true;
        }
    }
 
    private void button3_Click(object sender, EventArgs e)
    {
        pictureBox5.Location = new Point(30, 55);
        pictureBox11.Location = new Point(30, 35);
        //oyuna sponge bob başlar
        button1.Enabled = true;
        //oyuna başla düğmesi deaktif olur
        button3.Enabled = false;
    }
 
    private void button2_Click(object sender, EventArgs e)
    {
        //Rastgele Bir Zar Görüntülemek İçin
        Random zar = new Random();
        int zarr = zar.Next(6);
 
        //zarın koşulları
        if (zarrr[zarr] == 1)
        {
            // zar sonucunun resmini görüntülemek için
            pictureBox1.Visible = true;
            pictureBox4.Visible = false;
            pictureBox6.Visible = false;
            pictureBox7.Visible = false;
            pictureBox8.Visible = false;
            pictureBox9.Visible = false;
            // zar resminin altındaki sayıyı yazmak için
            label2.Text = "1";
            // ilerlenilen toplam kare sayısı
            c = c + 1;
        }
        if (zarrr[zarr] == 2)
        {
            // zar sonucunun resmini görüntülemek için
            pictureBox1.Visible = false;
            pictureBox4.Visible = true;
            pictureBox6.Visible = false;
            pictureBox7.Visible = false;
            pictureBox8.Visible = false;
            pictureBox9.Visible = false;
            // zar resminin altındaki sayıyı yazmak için
            label2.Text = "2";
            // ilerlenilen toplam kare sayısı
            c = c+ 2;
        }
        if (zarrr[zarr] == 3)
        {
            // zar sonucunun resmini görüntülemek için
            pictureBox1.Visible = false;
            pictureBox4.Visible = false;
            pictureBox6.Visible = false;
            pictureBox7.Visible = false;
            pictureBox8.Visible = false;
            pictureBox9.Visible = true;
            // zar resminin altındaki sayıyı yazmak için
            label2.Text = "3";
            // ilerlenilen toplam kare sayısı
            c = c + 3;
        }
        if (zarrr[zarr] == 4)
        {
            // zar sonucunun resmini görüntülemek için
            pictureBox1.Visible = false;
            pictureBox4.Visible = false;
            pictureBox6.Visible = false;
            pictureBox7.Visible = false;
            pictureBox8.Visible = true;
            pictureBox9.Visible = false;
            // zar resminin altındaki sayıyı yazmak için
            label2.Text = "4";
            // ilerlenilen toplam kare sayısı
            c = c + 4;
        }
        if (zarrr[zarr] == 5)
        {
            // zar sonucunun resmini görüntülemek için
            pictureBox1.Visible = false;
            pictureBox4.Visible = false;
            pictureBox6.Visible = false;
            pictureBox7.Visible = true;
            pictureBox8.Visible = false;
            pictureBox9.Visible = false;
            // zar resminin altındaki sayıyı yazmak için
            label2.Text = "5";
            // ilerlenilen toplam kare sayısı
            c = c + 5;
        }
        if (zarrr[zarr] == 6)
        {
            // zar sonucunun resmini görüntülemek için
            pictureBox1.Visible = false;
            pictureBox4.Visible = false;
            pictureBox6.Visible = true;
            pictureBox7.Visible = false;
            pictureBox8.Visible = false;
            pictureBox9.Visible = false;
            // zar resminin altındaki sayıyı yazmak için
            label2.Text = "6";
            // ilerlenilen toplam kare sayısı
            c = c + 6;
        }
 
        //patrik'in kaç kare gittiğini göstermek için
        //skorbord
        label7.Text = c.ToString();
 
        //piyonun ilerlemesini sağlayan koşul
        i = c;
        //oyunun kazanıldığının uyarılması
        if (c >= 80)
        {
            MessageBox.Show("Patrik Kazandı! " + label7.Text
                                               + " / " + label6.Text);
            //piyonların ortaya gelmesi
            pictureBox5.Location = new Point(375, 290);
            pictureBox11.Location = new Point(375, 270);
            //zar atma butonlarının kapatılması
            button1.Enabled = false;
            button2.Enabled = false;
            //oyuna başlama butonunun tekrar aktif olması
            button3.Enabled = true;
            // skorboardun sıfırlanması
            a = 0;
            c = 0;
            label6.Text = a.ToString();
            label7.Text = c.ToString();
        }
        else if (i > 74)
        {
            n = 30;
            m = 335;
            b = i - 74;
            pictureBox11.Location = new Point(n, m - (b * 50));
        }
        else if (i > 61)
        {
            n = 680;
            m = 335;
            b = i - 61;
            pictureBox11.Location = new Point(n - (b * 50), m);
        }
        else if (i > 55)
        {
            n = 730;
            m = 35;
            b = i - 55;
            pictureBox11.Location = new Point(n, m + (b * 50));
        }
        else if (i > 40)
        {
            n = 30;
            m = 35;
            b = i - 40;
            pictureBox11.Location = new Point(n + (b * 50), m);
        }
        else if (i > 34)
        {
            n = 30;
            m = 335;
            b = i - 34;
            pictureBox11.Location = new Point(n, m - (b * 50));
        }
        else if (i > 20)
        {
            n = 680;
            m = 335;
            b = i - 21;
            pictureBox11.Location = new Point(n - (b * 50), m);
        }
        else if (i > 14)
        {
            n = 730;
            m = 35;
            b = i - 14;
            pictureBox11.Location = new Point(n, m + (b * 50));
        }
 
        else
        {
        n = 30;
        m = 35;
        pictureBox11.Location = new Point(n + (i * 50), m);
        } 
 
        //zar atma sırası öbür oyuncuda
        if (c == 6 | c == 18 | c == 23 | c == 46 | c == 59 | c == 63)
        {
            MessageBox.Show("dadadada bir kere daha zar at");
        }
        else
        {
            button1.Enabled = true;
            button2.Enabled = false;
        }
        }
        }
    }

Comment » | Csharp - C#

Page 1 of 41234

Back to top