unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Menus, Buttons;
type
TForm1 =
class(TForm)
Image1: TImage;
Image2: TImage;
Image3: TImage;
MainMenu1: TMainMenu;
Datei1: TMenuItem;
Start1: TMenuItem;
Beenden1: TMenuItem;
Timer1: TTimer;
Timer2: TTimer;
Image4: TImage;
Image5: TImage;
procedure FormKeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
procedure Beenden1Click(Sender: TObject);
procedure Start1Click(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
a,b,i,x,y:integer;
implementation
{$R *.dfm}
procedure TForm1.Start1Click(Sender: TObject);
begin
form1.doublebuffered:=true;
x:=0; y:=0;
image1.picture.loadfromfile('
space4.bmp');
image2.picture.loadfromfile('
player1.bmp');
image3.picture.loadfromfile('
ufo5.bmp');
image4.picture.loadfromfile('
bullet1.bmp');
image4.Visible:=false;
image5.picture.loadfromfile('
red02.bmp');
image2.Left:=x;
image2.Top:=y;
form1.image4.Left:=a;
form1.image4.Top:=b;
timer1.Enabled:=true;
timer2.Enabled:=false;
end;
procedure Feuern;
begin
form1.image4.visible:=true;
form1.timer2.enabled:=true;
end;
procedure Tform1.FormKeyDown(Sender: TObject;
var Key: Word;
Shift: TShiftState);
var h: integer;
begin
//form1.Caption:=inttostr(key);
if key=37
then begin x:=x-5;
end;
if key=38
then begin y:=y-5;
end;
if key=39
then begin x:=x+5;
end;
if key=40
then begin y:=y+5;
end;
if key=17
then begin Feuern;
end;
end;
procedure TForm1.Timer2Timer(Sender: TObject);
begin
a:=a+1;
end;
procedure TForm1.Beenden1Click(Sender: TObject);
begin
close;
end;
end.