top of page
Ara

Form Aplication Zar Atma Oyunu

  • ByAdmin
  • 21 Ara 2015
  • 1 dakikada okunur

Hemen Hemen Herşeyde Oldugu Gİbi Bundada Zarlar İçin 1 le 6 Arası RAndo SAyı Üretiliyor..Mesala 1.Oyuncu Zarını Attı Sıra 2.Oyuncuya Geçiyor 1.Oyuncunun Tusu Enablet Oluyor YAni Tusu Kapanıyor...

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms;

namespace WinForm_Barbut { public partial class Form1 : Form { public Form1() { InitializeComponent(); } Random rnd = new Random(); int sayi1; int sayi2; private void Form1_Load(object sender, EventArgs e) { btnIkinci.Enabled = false; }

private void btnBirinci_Click(object sender, EventArgs e) { sayi1 = rnd.Next(1, 7); lblBirici.Text = sayi1.ToString(); btnBirinci.Enabled = false; btnIkinci.Enabled = true;

}

private void btnIkinci_Click(object sender, EventArgs e) { sayi2 = rnd.Next(1, 7); lblIkinci.Text = sayi2.ToString(); btnIkinci.Enabled = false;

if (sayi1>sayi2) { lblSonuc.Text = "Birinci Oyuncu Kazandı"; }else if(sayi1<sayi2) { lblSonuc.Text = "İkinci oyuncu kazandı"; } else { lblSonuc.Text = "Berabere bitti"; }

DialogResult sonuc = MessageBox.Show("Tekrar Oynamak istermisiniz?", "Oyun Bitti", MessageBoxButtons.YesNo);

if (sonuc==DialogResult.Yes) { lblBirici.Text = lblIkinci.Text = lblSonuc.Text = string.Empty; btnBirinci.Enabled = true; } else { this.Close(); } } } }

Comments


Tanıtılan Yazılar
Son Paylaşımlar
Arşiv
Etiketlere Göre Ara
Bizi Takip Edin
  • Facebook Basic Square
  • Twitter Basic Square
  • Google+ Basic Square
bottom of page