Thema: Delphi Galgenmännchen

Einzelnen Beitrag anzeigen

Tomislav

Registriert seit: 1. Dez 2005
34 Beiträge
 
#40

Re: Galgenmännchen

  Alt 3. Dez 2005, 11:33
Delphi-Quellcode:
procedure TForm1.Spieler1(Sender: TObject);
begin
 if
 (RBP1.Checked = true) and (lblString1.Caption = A) and (lblString2.Caption = B) and (lblString3.Caption = C) and (lblString4.Caption = D) and (lblString5.Caption = E) and (lblString6.Caption = F) and (lblString7.Caption = G) and (lblString8.Caption = H) and (lblString9.Caption = I) and (lblString10.Caption = J) and (lblString11.Caption = K) and (lblString12.Caption = L)
 then
 begin
 Application.MessageBox('Spieler 1 hat gewonnen!','Gewinner');
 btnWortwahlClick(Sender);
 end;

 if
 (Antwort = A) or (Antwort = B) or (Antwort = C) or (Antwort = D) or (Antwort = E) or (Antwort = F) or (Antwort = G) or (Antwort = H) or (Antwort = I) or (Antwort = J) or (Antwort = K) or (Antwort = L)
 then
 begin
 end
 else
 begin
 RBP1.Checked := false;
 RBP2.Checked := true;
 Application.MessageBox('Leider ist dieser Buchstabe nicht dabei! Spieler 2 ist an der Reihe!','!!!');
 aa := StrToInt(lblFehler1.Caption);
 aa := aa+1;
 lblFehler1.Caption := IntToStr(aa);
 end;
end;

procedure TForm1.Spieler2(Sender: TObject);
begin
 if
 (RBP2.Checked = true) and (lblString1.Caption = A) and (lblString2.Caption = B) and (lblString3.Caption = C) and (lblString4.Caption = D) and (lblString5.Caption = E) and (lblString6.Caption = F) and (lblString7.Caption = G) and (lblString8.Caption = H) and (lblString9.Caption = I) and (lblString10.Caption = J) and (lblString11.Caption = K) and (lblString12.Caption = L)
 then
 begin
 Application.MessageBox('Spieler 2 hat gewonnen!','Gewinner');
 btnWortwahlClick(Sender);
 end;

 if
 (Antwort = A) or (Antwort = B) or (Antwort = C) or (Antwort = D) or (Antwort = E) or (Antwort = F) or (Antwort = G) or (Antwort = H) or (Antwort = I) or (Antwort = J) or (Antwort = K) or (Antwort = L)
 then
 begin
 end
 else
 begin
 RBP2.Checked := false;
 RBP1.Checked := true;
 Application.MessageBox('Leider ist dieser Buchstabe nicht dabei! Spieler 1 ist an der Reihe!','!!!');
 bb := StrToInt(lblFehler2.Caption);
 bb := bb+1;
 lblFehler2.Caption := IntToStr(bb);
 end;

end;

procedure TForm1.PBP2OnPaint(Sender: TObject);
begin

 if
 (lblFehler2.Caption = '0')
 then
  begin
   with PBP2.canvas do
    begin
    x.x := 5;
    x.y := 65;
    y.x := 65;
    y.y := x.y;
    moveto(x.x, x.y);
    lineto(y.x, y.y);
    end;
  end;


 if
 (lblFehler2.Caption = '1')
 then
  begin
   with PBP2.canvas do
    begin
    x.x := 5;
    x.y := 65;
    y.x := 65;
    y.y := x.y;
    xx1.x := 20;
    xx1.y := x.y;
    xx2.x := 20;
    xx2.y := 10;
    moveto(x.x, x.y);
    lineto(y.x, y.y);
    moveto(xx1.x, xx1.y);
    lineto(xx2.x, xx2.y);
    end;
  end;
end;

procedure TForm1.PBP1OnPaint(Sender: TObject);
begin
  if
 (lblFehler1.Caption = '0')
 then
  begin
   with PBP1.canvas do
    begin
    x.x := 5;
    x.y := 65;
    y.x := 65;
    y.y := x.y;
    moveto(x.x, x.y);
    lineto(y.x, y.y);
    end;
  end;

 if
 (lblFehler1.Caption = '1')
 then
 begin
   with PBP1.canvas do
    begin
    x.x := 5;
    x.y := 65;
    y.x := 65;
    y.y := x.y;
    xx1.x := 20;
    xx1.y := x.y;
    xx2.x := 20;
    xx2.y := 10;
    moveto(x.x, x.y);
    lineto(y.x, y.y);
    moveto(xx1.x, xx1.y);
    lineto(xx2.x, xx2.y);
    end;
 end;
end;

end.
  Mit Zitat antworten Zitat