Einzelnen Beitrag anzeigen

Benutzerbild von Back2Code
Back2Code

Registriert seit: 6. Feb 2012
Ort: Deutschland
272 Beiträge
 
Delphi XE7 Professional
 
#1

Slotmaschine in Delphi - Bitte um Hilfsstellung

  Alt 23. Mär 2012, 10:28
Zurzeit arbeite ich an einer Slotmaschine wie eine, die man so aus den Casinos kennt. Sie ist noch relativ simpel gehalten und ich mache das ganze nur zu Lernzwecken.

Hier mal der aktuelle SCR Code :

Delphi-Quellcode:
unit Unit1;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, Windows, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
  ExtCtrls, ComCtrls, Menus, ActnList, Spin, FileCtrl;

type

  { TForm1 }

  TForm1 = class(TForm)
    FloatSpinEdit1: TFloatSpinEdit;
    Guthabenlb: TLabel;
    s4: TLabel;
    s5: TLabel;
    s6: TLabel;
    s7: TLabel;
    s8: TLabel;
    s9: TLabel;
    Timer3: TTimer;
    Winlb: TLabel;
    Loselb: TLabel;
    slotbn: TButton;
    s1: TLabel;
    s2: TLabel;
    s3: TLabel;
    Timer1: TTimer;
    Timer2: TTimer;
    procedure FormCreate(Sender: TObject);
    procedure slotbnClick(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure Timer2Timer(Sender: TObject);
    procedure Timer3Timer(Sender: TObject);
  private
    { private declarations }
    FRollen : array [0..2, 0..9] of String;
  public
    { public declarations }
  end;

var
  Form1: TForm1;
  wins,loses : Integer;
  guthaben : Double = 10;

implementation

{$R *.lfm}

{ TForm1 }

procedure TForm1.slotbnClick(Sender: TObject);
  begin
  Guthaben := Guthaben - 1.00;
  Guthabenlb.Caption := FloatToStr(guthaben) + ('');
  Timer1.Enabled := True;
  Timer2.Enabled := True;
  slotbn.Enabled := false;
end;

procedure TForm1.FormCreate(Sender: TObject);
var
  i: integer;
  j: integer;
  n: integer;
  digits: TStringlist;

  begin
  Digits := TStringList.Create;
  try
    for i := low(FRollen) to high(FRollen) do
    begin
      for j := low(FRollen[i]) to high(FRollen[i]) do
        Digits.Add(IntToStr(j));

      for j := low(FRollen[i]) to high(FRollen[i]) do
      begin
        n := Random(Digits.Count);
        FRollen[i, j] := Digits[n];
        Digits.Delete(n);
      end;

    end
  finally
    Digits.Free;
  end;

  for i:=low(FRollen) to high(FRollen) do
  begin


  end;
end;



//==================================================================================================\\
// Drehen der Slots im Zufallsmodus
//==================================================================================================//
procedure TForm1.Timer1Timer(Sender: TObject);
begin
s1.Caption := IntToStr(Random(9));
s2.Caption := IntToStr(Random(9));
s3.Caption := IntToStr(Random(9));
s4.Caption := IntToStr(Random(9));
s5.Caption := IntToStr(Random(9));
s6.Caption := IntToStr(Random(9));
s7.Caption := IntToStr(Random(9));
s8.Caption := IntToStr(Random(9));
s9.Caption := IntToStr(Random(9));
end;

//==================================================================================================//



//===================================================================================================\\
// Gewonnen / Verloren abfrage
//===================================================================================================//
procedure TForm1.Timer2Timer(Sender: TObject);
begin
  Timer1.Enabled := False;
  Timer2.Enabled := false;
  if (s1.Caption = s5.Caption) and (s1.Caption = s9.Caption) then
  begin
    Guthaben := Guthaben + 5.00;
    Inc(wins);
  end
  else
  if (s1.Caption = s4.Caption) and (s1.Caption = s7.Caption) then
  begin
    Guthaben := Guthaben + 5.00;
    Inc(wins);
  end
  else
    if (s2.Caption = s5.Caption) and (s2.Caption = s8.Caption) then
    begin
      Guthaben := Guthaben + 5.00;
      Inc(wins);
    end
    else
      if (s3.Caption = s6.Caption) and (s3.Caption = s9.Caption) then
      begin
        Guthaben := Guthaben + 5.00;
        Inc(wins);
      end
      else
        if (s3.Caption = s5.Caption) and (s3.Caption = s7.Caption) then
        begin
          Guthaben := Guthaben + 5.00;
          Inc(wins);
        end
        else
        Inc(loses);
        slotbn.Enabled := True;
        Loselb.Caption := 'Loses: ' + IntToStr(loses);
        Winlb.Caption := 'Wins: ' + IntTostr(Wins);
        end;

procedure TForm1.Timer3Timer(Sender: TObject);
begin
  if (guthaben = 0) or (guthaben < 0) then
  begin
  Timer3.Enabled := False;
  MessageBox(handle,'Du hast verloren!','Verlierer!',MB_OK);
  close();
end;

end;

//======================================================================================================\\


end.
Ich hab jetzt ein paar Fragen worauf ich noch keine gute Erklärung gefunden habe :

Wie kann ich die Labels durch Icons ersetzen( Also, dass man dann z.B 3 Kronen hat)

Wie kann ich die Gewinne spezifisch den Symbolen anpassen? (3 Äpfel z.B nur 4 €, 3 7er dann 400 )

Wie kann ich den Einsatz erhöhen und dadurch die Gewinne verringern/erhöhen.
  Mit Zitat antworten Zitat