Hi,
24/100?
Nenene du, das müssen 24/1000 sein. Nciht 24/100. Deswegen klappte das bei mir auch. Ich hab da aus reflex 24/1000 hingeschrieben. Änders mal (auch bei der Explosion)
Delphi-Quellcode:
constructor TAnimation.Create(AParent: TSprite);
begin
inherited Create(AParent);
Image := Form1.DXImageList1.Items.Find('1');
Width := Image.Width;
Height := Image.Height;
Visible := true;
AnimCount := 4;
AnimLooped := true;
AnimSPeed := 24/1000; //<--
AnimStart := 0;
end;
procedure TAnimation.DoMove(MoveCount: integer);
begin
inherited DoMove(MoveCount);
if FMove = true then
begin
if (IsUp in Form1.DXInput1.States) and (Y >= 0) then
Y := Y-vY;
if (IsDown in Form1.DXInput1.States) and (Y+Height <= Form1.DXDraw1.Height) then
Y := Y+vY;
if (IsLeft in Form1.DXInput1.States) and (X >= 0) then
X := X-vX;
if (ISRight in Form1.DXInput1.States) and (X+Width <= Form1.DXDraw1.Width) then
X := X+vX;
Collision;
end
else
if FCollision then
begin
if AnimPos = 3 then
Dead;
end;
end;
procedure TAnimation.DoCollision(Sprite: TSprite; var Done: boolean);
begin
if not FCollision then
begin
if Sprite is TStone then
begin
FCollision := true;
FMove := false;
Image := Form1.DXImageList1.Items.Find('Explosion');
Width := Image.Width;
Height := Image.Height;
AnimCount := Image.PatternCount;
AnimSpeed := 12/1000; //<--
AnimLooped := false;
AnimStart := 0;
Form1.DXWaveList1.Items.Find('Explosion').Play(false);
end;
end;
end;