unit Schuss;
interface
uses
Windows, Messages, SysUtils, Classes, Controls, Figur, Forms,Graphics,
Dialogs, ExtCtrls,DXClass;
type
TSchuss =
class(TImage)
private
ZTimer : TDXTimer;
ZForm: TForm;
ZSchuss: TIMage;
procedure bewegen(Sender: TObject; LagCount: Integer);
{ Private-Deklarationen }
protected
{ Protected-Deklarationen }
public
constructor erstelle(X,Y :integer; Formular: TForm);
{ Public-Deklarationen }
published
{ Published-Deklarationen }
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('
Beispiele', [TSchuss]);
end;
constructor TSchuss.erstelle(X,Y : integer; Formular: TForm);
begin
ZForm:=Formular;
ZSchuss := TImage.create(ZForm);
ZSchuss.parent := ZForm;
ZSchuss.picture.loadfromfile('
schuss.bmp');
ZSchuss.setbounds
(X,Y,5,7);
ZSchuss.Transparent := false;
ZSchuss.Stretch := true;
ZTimer := TDXTimer.create(ZForm);
ZTimer.Interval := 10;
ZTimer.ActiveOnly :=true;
Ztimer.Enabled := false;
ZTimer.Enabled := true;
ZTimer.OnTimer := bewegen;
end;
procedure TSchuss.bewegen(Sender: TObject; LagCount: Integer);
begin
ZSchuss.Top := ZSchuss.Top - 20;
//if ZSchuss.Top <= 0
//then Zschuss.Destroy;
end;
end.