unit FikroSoftRulet;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, Buttons, StdCtrls, Menus;
type
TForm1 = class(TForm)
SpeedButton1: TSpeedButton;
Panel1: TPanel;
Label1: TLabel;
Edit1: TEdit;
Button1: TButton;
Shape1: TShape;
Bahis: TEdit;
Button2: TButton;
Panel2: TPanel;
Label2: TLabel;
Para: TEdit;
para2: TEdit;
Label3: TLabel;
Bahis2: TEdit;
MainMenu1: TMainMenu;
Fle1: TMenuItem;
NewGame1: TMenuItem;
Quit1: TMenuItem;
Help1: TMenuItem;
HowToPlay1: TMenuItem;
AboutFikroSoft1: TMenuItem;
procedure FormCreate(Sender: TObject);
procedure Label1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure ParaChange(Sender: TObject);
procedure BahisChange(Sender: TObject);
procedure NewGame1Click(Sender: TObject);
procedure Quit1Click(Sender: TObject);
procedure AboutFikroSoft1Click(Sender: TObject);
procedure HowToPlay1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
s:array [1..40] of TSpeedButton;
i:integer;
implementation
uses help;
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
l,t:integer;
begin
Shape1.Visible:=False;
t:=0;
l:=0;
for i:=1 to 40 do begin
s[i]:=TSpeedButton.Create(self);
s[i].Parent:=panel1;
s[i].Height:=30;
s[i].Width:=30;
s[i].Left:=l;
s[i].top:=t;
s[i].Caption:=IntToStr(i);
s[i].Font:=SpeedButton1.Font;
s[i].SendToBack;
l:=l+30;
if ((i mod 8)=0) then
l:=0;
t:=0 + (i div 8)*30 ;
end;
Label1.Left:=0;
Label1.Top:=0;
Label1.Width:=240;
Label1.Height:=150;
Label1.BringToFront;
end;
procedure TForm1.Label1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
a,b:integer;
begin
if button=mbleft then begin
if y<30 then
begin
a:=(1+(x div 30));
if s[a].Font.Color=clBlue then begin
b:=StrToInt(Bahis.Text);
Bahis.Text:=IntToStr(b+10);
if b+10>400 then Bahis.Text:='400';
s[a].Font.Color:=clRed;
end;
end
else begin
if y<60 then
begin
a:=(9+(x div 30));
if s[a].Font.Color=clBlue then begin
b:=StrToInt(Bahis.Text);
Bahis.Text:=IntToStr(b+10);
if b+10>400 then Bahis.Text:='400';
s[a].font.Color:=clRed;
end;
end
else begin
if y<90 then
begin
a:=(17+(x div 30));
if s[a].Font.Color=clBlue then begin
b:=StrToInt(Bahis.Text);
Bahis.Text:=IntToStr(b+10);
if b+10>400 then Bahis.Text:='400';
s[a].Font.Color:=clRed;
end;
end
else begin
if y<120 then
begin
a:=(25+(x div 30));
if s[a].Font.Color=clBlue then begin
b:=StrToInt(Bahis.Text);
Bahis.Text:=IntToStr(b+10);
if b+10>400 then Bahis.Text:='400';
s[a].Font.Color:=clRed;
end;
end
else begin
if y<150 then
begin
a:=(33+(x div 30));
if s[a].Font.Color=clBlue then begin
b:=StrToInt(Bahis.Text);
Bahis.Text:=IntToStr(b+10);
if b+10>400 then Bahis.Text:='400';
s[a].Font.Color:=clRed;
end;
end;
end;
end;
end;
end;
end
else begin
if button=mbRight then begin
if y<30 then
begin
a:=(1+(x div 30));
if s[a].Font.Color=clRed then begin
b:=StrToInt(Bahis.Text);
Bahis.Text:=IntToStr(b-10);
if b-10<0 then Bahis.Text:='0';
s[a].font.Color:=clBlue;
end;
end
else begin
if y<60 then
begin
a:=(9+(x div 30));
if s[a].Font.Color=clRed then begin
b:=StrToInt(Bahis.Text);
Bahis.Text:=IntToStr(b-10);
if b-10<0 then Bahis.Text:='0';
s[a].font.Color:=clBlue;
end;
end
else begin
if y<90 then
begin
a:=(17+(x div 30));
if s[a].Font.Color=clRed then begin
b:=StrToInt(Bahis.Text);
Bahis.Text:=IntToStr(b-10);
if b-10<0 then Bahis.Text:='0';
s[a].Font.Color:=clBlue;
end;
end
else begin
if y<120 then
begin
a:=(25+(x div 30));
if s[a].Font.Color=clRed then begin
b:=StrToInt(Bahis.Text);
Bahis.Text:=IntToStr(b-10);
if b-10<0 then Bahis.Text:='0';
s[a].Font.Color:=clBlue;
end;
end
else begin
if y<150 then
begin
a:=(33+(x div 30));
if s[a].Font.Color=clRed then begin
b:=StrToInt(Bahis.Text);
Bahis.Text:=IntToStr(b-10);
if b-10<0 then Bahis.Text:='0';
s[a].Font.Color:=clBlue;
end;
end;
end;
end;
end;
end;
end;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
x,y,z,t,f:integer;
b:variant;
begin
Randomize;
x:=1+Random(40);
Edit1.Text:=IntToStr(x);
y:=StrToInt(Para.Text);
if y<0 Then ShowMessage('oyun bitti')
else begin
if s[x].Caption=intToStr(x) then
begin
Shape1.Visible:=True;
Shape1.BringToFront;
for i:=1 to 8 do begin
Randomize;
t:=1+Random(40);
Shape1.Left:=s[t].Left;
Shape1.top:=s[t].Top;
Shape1.Refresh;
sleep(300);
end;
Shape1.Left:=s[x].Left;
Shape1.top:=s[x].Top;
if s[x].Font.Color=clRed then
begin
b:=StrToInt(Bahis.Text);
Para.Text:=IntToStr(y+((40/b)*100));
if b=400 then Para.Text:=IntToStr(y);
end
else begin
z:=StrToInt(Bahis.Text);
Para.Text:=IntToStr(y-z);
end;
end;
end;
Label1.Enabled:=False;
Button1.Visible:=False;
Button2.Visible:=True;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
for i:=1 to 40 do
begin
s[i].Font.Color:=clBlue;
end;
Shape1.Visible:=False;
Bahis.Text:='0';
Button1.Visible:=True;
Button2.Visible:=False;
Label1.Enabled:=True;
end;
procedure TForm1.ParaChange(Sender: TObject);
begin
Para2.Text:=Para.Text+' $';
end;
procedure TForm1.BahisChange(Sender: TObject);
begin
Bahis2.Text:=Bahis.Text+' $';
end;
procedure TForm1.NewGame1Click(Sender: TObject);
begin
Button1.Visible:=True;
Button2.Visible:=False;
Para.Text:='1000';
Bahis.Text:='0';
Shape1.Visible:=False;
Edit1.Text:='0';
for i:=1 to 40 do begin
s[i].Font.Color:=clBlue;
end;
end;
procedure TForm1.Quit1Click(Sender: TObject);
begin
Form1.Close;
end;
procedure TForm1.AboutFikroSoft1Click(Sender: TObject);
begin
ShowMessage('Coder :Fikret Özer'+' Date:2003');
end;
procedure TForm1.HowToPlay1Click(Sender: TObject);
begin
with TForm2.Create(application)do
show;
end;
end.