Search Results

Search found 2 results on 1 pages for 'raiden2k'.

Page 1/1 | 1 

  • problems with my slotgame [delphi]

    - by Raiden2k
    hey guys im coding at the moment on a slotgame for the learning effect. here is the source code. my questions are below: 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. How can i replace the labels through icons 16 x 16 pixels? How can i adjust the winning sum according to the icons.(for example 3 crowns give you 40 € and 3 apples only 10 €) How can i adhust the winning sum with a sum for every round?

    Read the article

  • Problems with my slotgame

    - by Raiden2k
    I'm coding a slot game for learning. Here's the source code. My questions are below. 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. How can I replace the labels through icons 16 x 16 pixels? How can I adjust the winning sum according to the icons? (for example 3 crowns give you 40 € and 3 apples only 10 €) How can I adjust the winning sum with a sum for every round?

    Read the article

1