Thema: Delphi kniffel - zahlenabfrage

Einzelnen Beitrag anzeigen

pheel

Registriert seit: 26. Mai 2010
Ort: Frankfurt a.M.
4 Beiträge
 
Delphi 6 Personal
 
#3

Re: kniffel - zahlenabfrage

  Alt 26. Mai 2010, 20:49
Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls;

type
  TForm1 = class(TForm)
    Shape1: TShape;
    CheckBox1: TCheckBox;
    CheckBox2: TCheckBox;
    CheckBox3: TCheckBox;
    CheckBox4: TCheckBox;
    CheckBox5: TCheckBox;
    Image1: TImage;
    Image2: TImage;
    Image3: TImage;
    Image4: TImage;
    Image5: TImage;
    Image6: TImage;
    Image7: TImage;
    Image8: TImage;
    Image9: TImage;
    Image10: TImage;
    Image11: TImage;
    Image12: TImage;
    Image13: TImage;
    Image14: TImage;
    Image15: TImage;
    Image16: TImage;
    Image17: TImage;
    Image18: TImage;
    Image19: TImage;
    Image20: TImage;
    Image21: TImage;
    Image22: TImage;
    Image23: TImage;
    Image24: TImage;
    Image25: TImage;
    Image26: TImage;
    Image27: TImage;
    Image28: TImage;
    Image29: TImage;
    Image30: TImage;
    BtWurf: TButton;
    procedure BtWurfClick(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;
  w1,w2,w3,w4,w5,w6: integer;
implementation

{$R *.dfm}

procedure TForm1.BtWurfClick(Sender: TObject);
begin

randomize;
if CheckBox1.Checked = false then //ich frage ab welcher würfel gewürfelt wird
 begin
  Image1.Visible:=false;
  Image2.Visible:=false;
  Image3.Visible:=false;
  Image4.Visible:=false;
  Image5.Visible:=false;
  Image6.Visible:=false;
  w1:=random(6)+1;
 end;
if CheckBox2.Checked = false then
 begin
  Image7.Visible:=false;
  Image8.Visible:=false;
  Image9.Visible:=false;
  Image10.Visible:=false;
  Image11.Visible:=false;
  Image12.Visible:=false;
  w2:=random(6)+1;
 end;
if CheckBox3.Checked = false then
 begin
  Image13.Visible:=false;
  Image14.Visible:=false;
  Image15.Visible:=false;
  Image16.Visible:=false;
  Image17.Visible:=false;
  Image18.Visible:=false;
  w3:=random(6)+1;
 end;
if CheckBox4.Checked = false then
 begin
  Image19.Visible:=false;
  Image20.Visible:=false;
  Image21.Visible:=false;
  Image22.Visible:=false;
  Image23.Visible:=false;
  Image24.Visible:=false;
  w4:=random(6)+1;
 end;
if CheckBox5.Checked = false then
 begin
  Image25.Visible:=false;
  Image26.Visible:=false;
  Image27.Visible:=false;
  Image28.Visible:=false;
  Image29.Visible:=false;
  Image30.Visible:=false;
  w5:=random(6)+1;
 end;

if w1 = 1 then //fragt ab und zeigt die bilder
 Image1.Visible:=true;
if w1 = 2 then
 Image2.Visible:=true;
if w1 = 3 then
 Image3.Visible:=true;
if w1 = 4 then
 Image4.Visible:=true;
if w1 = 5 then
 Image5.Visible:=true;
if w1 = 6 then
 Image6.Visible:=true;

if w2 = 1 then
 Image7.Visible:=true;
if w2 = 2 then
 Image8.Visible:=true;
if w2 = 3 then
 Image9.Visible:=true;
if w2 = 4 then
 Image10.Visible:=true;
if w2 = 5 then
 Image11.Visible:=true;
if w2 = 6 then
 Image12.Visible:=true;

if w3 = 1 then
 Image13.Visible:=true;
if w3 = 2 then
 Image14.Visible:=true;
if w3 = 3 then
 Image15.Visible:=true;
if w3 = 4 then
 Image16.Visible:=true;
if w3 = 5 then
 Image17.Visible:=true;
if w3 = 6 then
 Image18.Visible:=true;

if w4 = 1 then
 Image19.Visible:=true;
if w4 = 2 then
 Image20.Visible:=true;
if w4 = 3 then
 Image21.Visible:=true;
if w4 = 4 then
 Image22.Visible:=true;
if w4 = 5 then
 Image23.Visible:=true;
if w4 = 6 then
 Image24.Visible:=true;

if w5 = 1 then
 Image25.Visible:=true;
if w5 = 2 then
 Image26.Visible:=true;
if w5 = 3 then
 Image27.Visible:=true;
if w5 = 4 then
 Image28.Visible:=true;
if w5 = 5 then
 Image29.Visible:=true;
if w5 = 6 then
 Image30.Visible:=true;
end;

end.
so soviel hab ich und jetzt möchte ich, dass das programm erkennt wieviele 6er oder 3er oder 4er ich "gewürfelt" habe.
image1 bis image30 sind bilder zu den würfeln. also die gewürfelte zahl als bild eines würfels^^
  Mit Zitat antworten Zitat