Selamat datang di blog Strain alonso... Semoga apa yang ada diblog ini bermanfaat.

Pages

Saturday, April 14, 2012

Game Menangkap Anjing

unit U_pert1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, jpeg, ExtCtrls, GIFImg, pngimage, u_pert2;

type
  TBENSAN = class(TForm)
    Image1: TImage;
    Image2: TImage;
    Image3: TImage;
    Image4: TImage;
    Image5: TImage;
    Label1: TLabel;
    Edit1: TEdit;
    Button1: TButton;
    Button2: TButton;
    Timer1: TTimer;
    Button3: TButton;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure Image2Click(Sender: TObject);
    procedure Image2MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure Image3MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure Image4Click(Sender: TObject);
    procedure Image5MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure Image1Click(Sender: TObject);
    procedure Image3Click(Sender: TObject);
    procedure Image4MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure Image5Click(Sender: TObject);
    procedure Edit1Change(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure Button3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
     procedure aktif;
     procedure nonaktif;
  end;

var
  BENSAN: TBENSAN;

implementation

{$R *.dfm}

procedure TBENSAN.aktif;
begin
  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 TBENSAN.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 TBENSAN.Timer1Timer(Sender: TObject);
begin
nonaktif;
timer1.enabled:=false;
edit1.Text:='0';
messagedlg('maaf anda kalah',mtinformation,[mbOk],0);
end;

procedure TBENSAN.Button1Click(Sender: TObject);
begin
timer1.Interval:=10000;
timer1.Enabled:=true;
Aktif;
end;

procedure TBENSAN.Button2Click(Sender: TObject);
begin
nonaktif;
timer1.Enabled:=false;
end;

procedure TBENSAN.Button3Click(Sender: TObject);
begin
if application.MessageBox('Apakah Anda Ingin Keluar?','Pesan',36)=idyes then
close;
end;

procedure TBENSAN.Edit1Change(Sender: TObject);
begin
if edit1.Text='100' then
begin
  nonaktif;
  timer1.Enabled:=false;
  application.MessageBox('Selamat Anda Menang','Pesan',64);
  edit1.Text:='0';
end;
end;

procedure TBENSAN.FormCreate(Sender: TObject);
begin
timer1.Enabled:=false;
nonaktif;
end;

procedure TBENSAN.Image1Click(Sender: TObject);
begin
image1.Visible:=false;
edit1.Text:=inttostr(strtoint(edit1.Text)+20);
end;

procedure TBENSAN.Image2Click(Sender: TObject);
begin
image2.Visible:=false;
edit1.Text:=inttostr(strtoint(edit1.Text)+20);
end;

procedure TBENSAN.Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
image1.Left:=random(left);
image1.Top:=random(top);
end;

procedure TBENSAN.Image2MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
image2.Left:=random(left);
image2.Top:=random(top);
end;

procedure TBENSAN.Image3Click(Sender: TObject);
begin
image3.Visible:=false;
edit1.Text:=inttostr(strtoint(edit1.Text)+20);
end;

procedure TBENSAN.Image3MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
image3.Left:=random(left);
image3.Top:=random(top);
end;

procedure TBENSAN.Image4Click(Sender: TObject);
begin
image4.Visible:=false;
edit1.Text:=inttostr(strtoint(edit1.Text)+20);

end;

procedure TBENSAN.Image4MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
image4.Left:=random(left);
image4.Top:=random(top);
end;

procedure TBENSAN.Image5Click(Sender: TObject);
begin
image5.Visible:=false;
edit1.Text:=inttostr(strtoint(edit1.Text)+20);
end;

procedure TBENSAN.Image5MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
image5.Left:=random(left);
image5.Top:=random(top);
end;

end.

0 comments:

Post a Comment