unit U_timer;
interface
uses
Windows, Messages, SysUtils,
Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, jpeg,
ExtCtrls;
type
TForm1 = class(TForm)
Image1: TImage;
Image2: TImage;
Image3: TImage;
Image4: TImage;
Image5: TImage;
Label1: TLabel;
Edit1: TEdit;
Button1: TButton;
Button2: TButton;
Timer1: TTimer;
procedure FormCreate(Sender:
TObject);
procedure
Button1Click(Sender: TObject);
procedure
Button2Click(Sender: TObject);
procedure Image1Click(Sender:
TObject);
procedure Image2Click(Sender:
TObject);
procedure Image3Click(Sender:
TObject);
procedure Image4Click(Sender:
TObject);
procedure Image5Click(Sender:
TObject);
procedure
Image4MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure
Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure Image2MouseMove(Sender:
TObject; Shift: TShiftState; X,
Y: Integer);
procedure
Image3MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure
Image5MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure Edit1Change(Sender:
TObject);
procedure Timer1Timer(Sender:
TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure aktif;
procedure nonaktif;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure tform1.aktif;
begin
edit1.Text:='0';
image1.Enabled:=True;
image2.Enabled:=True;
image3.Enabled:=True;
image4.Enabled:=True;
image5.Enabled:=True;
button2.Enabled:=True;
image1.Visible:=True;
image2.Visible:=True;
image3.Visible:=True;
image4.Visible:=True;
image5.Visible:=True;
end;
procedure tform1.nonaktif;
begin
image1.Enabled:=False;
image2.Enabled:=False;
image3.Enabled:=False;
image4.Enabled:=False;
image5.Enabled:=False;
edit1.Enabled:=False;
button2.Enabled:=False;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
nonaktif;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
aktif;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
close;
end;
procedure TForm1.Image1Click(Sender: TObject);
begin
image1.visible:=false;
edit1.Text:=inttostr(strtoint(edit1.Text)+20);
end;
procedure TForm1.Image2Click(Sender: TObject);
begin
image1.visible:=false;
edit1.Text:=inttostr(strtoint(edit1.Text)+20);
end;
procedure TForm1.Image3Click(Sender: TObject);
begin
image1.visible:=false;
edit1.Text:=inttostr(strtoint(edit1.Text)+20);
end;
procedure TForm1.Image4Click(Sender: TObject);
begin
image1.visible:=false;
edit1.Text:=inttostr(strtoint(edit1.Text)+20);
end;
procedure TForm1.Image5Click(Sender: TObject);
begin
image1.visible:=false;
edit1.Text:=inttostr(strtoint(edit1.Text)+20);
end;
procedure TForm1.Image4MouseMove(Sender: TObject; Shift: TShiftState;
X,
Y: Integer);
begin
image4.Left:=random(left);
image4.Top:=random(top);
end;
procedure TForm1.Image1MouseMove(Sender: TObject; Shift: TShiftState;
X,
Y: Integer);
begin
image1.Left:=random(left);
image1.Top:=random(top);
end;
procedure TForm1.Image2MouseMove(Sender: TObject; Shift: TShiftState;
X,
Y: Integer);
begin
image2.Left:=random(left);
image2.Top:=random(top);
end;
procedure TForm1.Image3MouseMove(Sender: TObject; Shift: TShiftState;
X,
Y: Integer);
begin
image3.Left:=random(left);
image3.Top:=random(top);
end;
procedure TForm1.Image5MouseMove(Sender: TObject; Shift: TShiftState;
X,
Y: Integer);
begin
image5.Left:=random(left);
image5.Top:=random(top);
end;
procedure TForm1.Edit1Change(Sender: TObject);
begin
if edit1.Text='100' then
begin
nonaktif;
ShowMessage('Selamat Anda
Menang');
edit1.Text:='0';
end
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
nonaktif;
timer1.Enabled:=False;
ShowMessage('Game Over');
end;
0 komentar:
Post a Comment