procedure TForm1.Timer1Timer(Sender: TObject);
begin
if Geg.Top < Spi.Top
then
Geg.Top := Geg.Top + 1
else
if Geg.Top > Spi.Top
then
Geg.Top := Geg.Top - 1;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Screen.Cursor := -1;
Form1.DoubleBuffered := true;
i := 5;
end;
procedure TForm1.PaintBox1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
Spi.Left := X;
Spi.Top := Y;
end;
procedure TForm1.PaintBox1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
{ Schuss.Visible := true;
Schuss.Left := Spi.Left;
Schuss.Top := Spi.Top + 9; }
Sch := TImage.Create(Paintbox1);
Sch.Picture.LoadFromFile('
Schuss.bmp');
Sch.Left := Spi.Left;
Sch.Top := Spi.Top;
Sch.Parent := Form1;
Timer4.Enabled := true;
end;
procedure TForm1.PaintBox1Paint(Sender: TObject);
begin
if Paintbox1.Canvas.Pixels[Sch.Left,Sch.Top] = clblack
then
begin
dec(i,1);
Label1.Caption := '
Leben: ' + inttostr(i);
if I < 1
then
begin
Timer1.Enabled := false;
Geg.Free;
end;
end;
end;
procedure TForm1.Timer4Timer(Sender: TObject);
begin
Sch.Left := Sch.Left - 10;
end;
procedure TForm1.FormShow(Sender: TObject);
begin
Sch := TImage.Create(Paintbox1);
Sch.Picture.LoadFromFile('
Schuss.bmp');
Sch.Left := 0;
Sch.Top := 0;
Sch.Parent := Form1;
end;
procedure TForm1.Timer2Timer(Sender: TObject);
begin
if Geg.Top = Spi.Top
then
Timer5Timer(Sender);
end;
procedure TForm1.Timer3Timer(Sender: TObject);
begin
Sch1.Left := Sch1.Left + 10;
end;
procedure TForm1.Timer5Timer(Sender: TObject);
begin
Sch1 := TImage.Create(Paintbox1);
Sch1.Picture.LoadFromFile('
Schuss.bmp');
Sch1.Left := Geg.Left;
Sch1.Top := Geg.Top;
Sch1.Parent := Form1;
Timer3.Enabled := true;
end;