|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
Shape1: TShape;
Timer1: TTimer;
Shape2: TShape;
Timer2: TTimer;
Shape3: TShape;
Timer3: TTimer;
Shape4: TShape;
Timer4: TTimer;
Shape5: TShape;
Timer5: TTimer;
Shape6: TShape;
Shape7: TShape;
Timer6: TTimer;
Timer7: TTimer;
Shape8: TShape;
Timer8: TTimer;
Shape9: TShape;
Image1: TImage;
Timer10: TTimer;
Timer11: TTimer;
Timer12: TTimer;
Timer13: TTimer;
Timer14: TTimer;
Timer15: TTimer;
Timer16: TTimer;
Timer17: TTimer;
Timer18: TTimer;
Label1: TLabel;
Timer9: TTimer;
Label2: TLabel;
procedure Timer1Timer(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
procedure Timer3Timer(Sender: TObject);
procedure Timer4Timer(Sender: TObject);
procedure Timer5Timer(Sender: TObject);
procedure Timer6Timer(Sender: TObject);
procedure Timer7Timer(Sender: TObject);
procedure Timer8Timer(Sender: TObject);
procedure Timer9Timer(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure Timer10Timer(Sender: TObject);
procedure Timer11Timer(Sender: TObject);
procedure Timer12Timer(Sender: TObject);
procedure Timer13Timer(Sender: TObject);
procedure Timer14Timer(Sender: TObject);
procedure Timer15Timer(Sender: TObject);
procedure Timer16Timer(Sender: TObject);
procedure Timer17Timer(Sender: TObject);
procedure Timer18Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Timer1Timer(Sender: TObject);
begin
shape1.Left:=shape1.Left+1;
if shape1.Left>=900 then
shape1.Left:=-100;
end;
procedure TForm1.Timer2Timer(Sender: TObject);
begin
shape2.Left:=shape2.Left-2;
if shape2.Left<=-95 then
shape2.Left:=900;
end;
procedure TForm1.Timer3Timer(Sender: TObject);
begin
shape3.Left:=shape3.Left+3;
if shape3.Left>=900 then
shape3.Left:=-90;
end;
procedure TForm1.Timer4Timer(Sender: TObject);
begin
shape4.Left:=shape4.Left-3;
if shape4.Left<=-85 then
shape4.Left:=900;
end;
procedure TForm1.Timer5Timer(Sender: TObject);
begin
shape5.Left:=shape5.Left+4;
if shape5.Left>=900 then
shape5.Left:=-80;
end;
procedure TForm1.Timer6Timer(Sender: TObject);
begin
shape6.Left:=shape6.Left-6;
if shape6.Left<=-75 then
shape6.Left:=900;
end;
procedure TForm1.Timer7Timer(Sender: TObject);
begin
shape7.Left:=shape7.Left+2;
if shape7.Left>=900 then
shape7.Left:=-70;
end;
procedure TForm1.Timer8Timer(Sender: TObject);
begin
shape8.Left:=shape8.Left-3;
if shape8.Left<=65 then
shape8.Left:=900;
end;
procedure TForm1.Timer9Timer(Sender: TObject);
begin
shape9.Left:=shape9.Left+3;
if shape9.Left>=900 then
shape9.Left:=-60;
end;
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (key=vk_up) and (Image1.Top=410) and (Image1.Left>=Shape1.Left) and (Image1.Left<=Shape1.Left+100) then
begin
Timer10.Enabled:=true;
Timer11.Enabled:=false;
Timer12.Enabled:=false;
Timer13.Enabled:=false;
Timer14.Enabled:=false;
Timer15.Enabled:=false;
Timer16.Enabled:=false;
Timer17.Enabled:=false;
Timer18.Enabled:=false;
end;
if (key=vk_up) and (Image1.Top=370) and (Image1.Left>=Shape2.Left) and (Image1.Left<=Shape2.Left+95) then
begin
Timer10.Enabled:=false;
Timer11.Enabled:=true;
Timer12.Enabled:=false;
Timer13.Enabled:=false;
Timer14.Enabled:=false;
Timer15.Enabled:=false;
Timer16.Enabled:=false;
Timer17.Enabled:=false;
Timer18.Enabled:=false;
end;
if (key=vk_up) and (Image1.Top=330) and (Image1.Left>=Shape3.Left) and (Image1.Left<=Shape3.Left+90) then
begin
Timer10.Enabled:=false;
Timer11.Enabled:=false;
Timer12.Enabled:=true;
Timer13.Enabled:=false;
Timer14.Enabled:=false;
Timer15.Enabled:=false;
Timer16.Enabled:=false;
Timer17.Enabled:=false;
Timer18.Enabled:=false;
end;
if (key=vk_up) and (Image1.Top=290) and (Image1.Left>=Shape4.Left) and (Image1.Left<=Shape4.Left+85) then
begin
Timer10.Enabled:=false;
Timer11.Enabled:=false;
Timer12.Enabled:=false;
Timer13.Enabled:=true;
Timer14.Enabled:=false;
Timer15.Enabled:=false;
Timer16.Enabled:=false;
Timer17.Enabled:=false;
Timer18.Enabled:=false;
end;
if (key=vk_up) and (Image1.Top=250) and (Image1.Left>=Shape5.Left) and (Image1.Left<=Shape5.Left+80) then
begin
Timer10.Enabled:=false;
Timer11.Enabled:=false;
Timer12.Enabled:=false;
Timer13.Enabled:=false;
Timer14.Enabled:=true;
Timer15.Enabled:=false;
Timer16.Enabled:=false;
Timer17.Enabled:=false;
Timer18.Enabled:=false;
end;
if (key=vk_up) and (Image1.Top=210) and (Image1.Left>=Shape6.Left) and (Image1.Left<=Shape6.Left+75) then
begin
Timer10.Enabled:=false;
Timer11.Enabled:=false;
Timer12.Enabled:=false;
Timer13.Enabled:=false;
Timer14.Enabled:=false;
Timer15.Enabled:=true;
Timer16.Enabled:=false;
Timer17.Enabled:=false;
Timer18.Enabled:=false;
end;
if (key=vk_up) and (Image1.Top=170) and (Image1.Left>=Shape7.Left) and (Image1.Left<=Shape7.Left+70) then
begin
Timer10.Enabled:=false;
Timer11.Enabled:=false;
Timer12.Enabled:=false;
Timer13.Enabled:=false;
Timer14.Enabled:=false;
Timer15.Enabled:=false;
Timer16.Enabled:=true;
Timer17.Enabled:=false;
Timer18.Enabled:=false;
end;
if (key=vk_up) and (Image1.Top=130) and (Image1.Left>=Shape8.Left) and (Image1.Left<=Shape8.Left+65) then
begin
Timer10.Enabled:=false;
Timer11.Enabled:=false;
Timer12.Enabled:=false;
Timer13.Enabled:=false;
Timer14.Enabled:=false;
Timer15.Enabled:=false;
Timer16.Enabled:=false;
Timer17.Enabled:=true;
Timer18.Enabled:=false;
end;
if (key=vk_up) and (Image1.Top=90) and (Image1.Left>=Shape9.Left) and (Image1.Left<=Shape9.Left+60) then
begin
Timer10.Enabled:=false;
Timer11.Enabled:=false;
Timer12.Enabled:=false;
Timer13.Enabled:=false;
Timer14.Enabled:=false;
Timer15.Enabled:=false;
Timer16.Enabled:=false;
Timer17.Enabled:=false;
Timer18.Enabled:=true;
end;
end;
procedure TForm1.Timer10Timer(Sender: TObject);
begin
Image1.Top:=370;
Image1.Left:=Image1.Left+1;
if (Image1.Left<0) or (Image1.Left>900) then
begin
Label1.Visible:=true;
Label1.Caption:='你输了!';
end;
end;
procedure TForm1.Timer11Timer(Sender: TObject);
begin
Image1.Top:=330;
Image1.Left:=Image1.Left-2;
if (Image1.Left<0) or (Image1.Left>900) then
begin
Label1.Visible:=true;
Label1.Caption:='你输了!';
end;
end;
procedure TForm1.Timer12Timer(Sender: TObject);
begin
Image1.Top:=290;
Image1.Left:=Image1.Left+3;
if (Image1.Left<0) or (Image1.Left>900) then
begin
Label1.Visible:=true;
Label1.Caption:='你输了!';
end;
end;
procedure TForm1.Timer13Timer(Sender: TObject);
begin
Image1.Top:=250;
Image1.Left:=Image1.Left-3;
if (Image1.Left<0) or (Image1.Left>900) then
begin
Label1.Visible:=true;
Label1.Caption:='你输了!';
end;
end;
procedure TForm1.Timer14Timer(Sender: TObject);
begin
Image1.Top:=210;
Image1.Left:=Image1.Left+4;
if (Image1.Left<0) or (Image1.Left>900) then
begin
Label1.Visible:=true;
Label1.Caption:='你输了!';
end;
end;
procedure TForm1.Timer15Timer(Sender: TObject);
begin
Image1.Top:=170;
Image1.Left:=Image1.Left-6;
if (Image1.Left<0) or (Image1.Left>900) then
begin
Label1.Visible:=true;
Label1.Caption:='你输了!';
end;
end;
procedure TForm1.Timer16Timer(Sender: TObject);
begin
Image1.Top:=130;
Image1.Left:= Image1.Left+2;
if (Image1.Left<0) or (Image1.Left>900) then
begin
Label1.Visible:=true;
Label1.Caption:='你输了!';
end;
end;
procedure TForm1.Timer17Timer(Sender: TObject);
begin
Image1.Top:=90;
Image1.Left:=Image1.Left-3;
if (Image1.Left<0) or (Image1.Left>900) then
begin
Label1.Visible:=true;
Label1.Caption:='你输了!';
end;
end;
procedure TForm1.Timer18Timer(Sender: TObject);
begin
Image1.Top:=50;
Image1.Left:=Image1.Left+3;
if Image1.Top=50 then;
begin
Label1.Visible:=true;
Label1.Caption:='你赢了!';
end;
end;
end. |
|