Hi,
Delphi-Quellcode:
procedure TFrPlayer.DoCollision(Sprite : TSprite; var Done: Boolean);
begin
if (Sprite is TFrBackground) and ((Sprite as TFrBackground).BackgroundType = btWall) then
begin
Done := true;
FColl := true;
end else
begin
Done := false;
FColl := false;
end;
end;
function TFrPlayer.MovePlayer(const ADirection: TDirection;
const ADistance: Extended): Boolean;
begin
Result := True;
case ADirection of
dUp: Y := Y - ADistance;
dDown: Y := Y + ADistance;
dRight: X := X + ADistance;
dLeft: X := X - ADistance;
end;
Collision;
if FColl then
begin
case ADirection of
dUp: Y := Y + ADistance;
dDown: Y := Y - ADistance;
dRight: X := X - ADistance;
dLeft: X := X + ADistance;
end;
end;
end;
So wie beschrieben: Die Funktion DoCollison wird nicht aufgerufen ?! Sehr wohl aber Collision; o.O