Hallo,
warum funktioniert folgender Code nicht?
Delphi-Quellcode:
type
tcar = class(timagesprite)
private
public
procedure DoMove(MoveCount: Integer); override;
end;
var
Form1: TForm1;
car: tcar;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
car := tcar.Create(dxspriteengine1.Engine);
car.Image := dximagelist1.Items.Find('1');
car.X := 0;
car.Y := 0;
car.Width := car.Image.Width;
car.Height := car.Image.Height;
form1.DoubleBuffered := true;
dxdraw1.DoubleBuffered := true;
end;
procedure tcar.DoMove(movecount: integer);
begin
if isLeft in Form1.DxInput1.States then
car.X := car.X -3;
if isRight in Form1.DxInput1.States then
car.X := car.X +3;
end;
procedure TForm1.FormPaint(Sender: TObject);
begin
form1.dxspriteengine1.Draw;
form1.dxdraw1.Flip;
end;
procedure TForm1.DXTimer1Timer(Sender: TObject; LagCount: Integer);
begin
form1.dxspriteengine1.Draw;
form1.dxdraw1.Flip;
end;
end.
Gruß
Spurius