void sifirlama; var tempBtn: TClProButton; tempLabel: TClProLabel; k: Integer; {
rastgeleIndex = clMath.GenerateRandom(0, 80); kelime = kelimeler[rastgeleIndex]; secilenIpucu = ipucular[rastgeleIndex]; ipucuLabel.Text = 'İpucu: ' + secilenIpucu; ipucuBtn.Enabled = True; ipucuLabel.Visible = False;
hatasayisi = 0; if (popupPanel <> nil) popupPanel.Visible = False; if (ipucubtn <> nil) ipucubtn.Enabled = True;
// 3. İskeleti Sıfırla if (iskelet <> nil) { iskelet.opacity = 0; iskelet.clProSettings.PictureSource = 'bos'; iskelet.SetclProSettings(iskelet.clProSettings); }
//labelların fazlaları sil for (k = 1 to 30) { tempLabel = TClProLabel(myform.FindComponent('label' + IntToStr(k))); if (tempLabel <> nil) { if (k <= Length(kelime)) { tempLabel.Text = ' _ '; tempLabel.Visible = True; } else { tempLabel.Visible = False; } } } for (k = 1 to 29) { tempBtn = TClProButton(myform.FindComponent('harf' + IntToStr(k))); if (tempBtn <> nil) { tempBtn.Enabled = True; } } ShowMessage('Yeni oyun başladı! Başarılar.'); } void HarfKontrol; var basilanButon:TclProButton; basilanHarf:String; j,k:Integer; bulundu:Boolean; tempComp,kontrolLabel: TClProLabel; oyunBitti:Boolean; { basilanButon =TClProButton(myform.Clsender); basilanHarf =basilanButon.Text; bulundu=False;
for (j=1 to Length(kelime)) { if (Copy(kelime, j, 1) == basilanHarf) { tempComp = TClProLabel(myform.FindComponent('label' + IntToStr(j))); //labeli elinde tutup gideceği yere yerleştirir if (tempComp <> nil) { tempComp.Text = basilanHarf; bulundu = True; }}}
if(bulundu==False) { ShowMessage(basilanHarf +' harfi bulunmamaktadır...'); hatasayisi=hatasayisi+1; if(hatasayisi==0) { iskelet.clProSettings.PictureSource = 'bos';}
else if (hatasayisi == 1) { iskelet.clProSettings.PictureSource = 'kafaa'; } else if (hatasayisi == 2) { iskelet.clProSettings.PictureSource = 'govdee'; } else if (hatasayisi == 3) { iskelet.clProSettings.PictureSource = 'tekkoll'; } else if (hatasayisi == 4) { iskelet.clProSettings.PictureSource = 'ciftkoll'; } else if (hatasayisi == 5) { iskelet.clProSettings.PictureSource = 'tekbacakk'; } else if (hatasayisi == 6) { iskelet.clProSettings.PictureSource = 'tamm'; }
//resimlerin değişmesini sağlar iskelet.opacity=1; iskelet.SetclProSettings(iskelet.clProSettings); if (hatasayisi == 6) { ShowMessage('Hakkınız bitti! Kaybettiniz... Kelime: ' + kelime); popupPanel.Visible = True; //sifirlama(); buraya truedan false geçirir } } oyunBitti = True; for (k = 1 to Length(kelime)) { kontrolLabel = TClProLabel(myform.FindComponent('label' + IntToStr(k))); if (kontrolLabel.Text == ' _ ') { oyunBitti = False; Break; } } if (oyunBitti == True) { ShowMessage('Tebrikler! Kelimeyi ' + IntToStr(hatasayisi) + ' hata ile bildiniz: ' + kelime); ShowMessage('Tebrikler Kazandınız...'); popupPanel.Visible = True; //sifirlama(); } basilanButon.Enabled=False; } hatamı bu şekilde çözdüm
|