Nur mal so als Lösungsansatz:
Delphi-Quellcode:
type
TMyImage = class(TImage)
public
StartTime: TDateTime;
Speed: Integer;
end;
var
FImages: TList;
procedure TForm1.NewImage;
var
Img: TMyImage;
begin
Img := TMyImage.Create(Self);
Img.Parent := Self;
Img.StartTime := Now + 5;
Img.Speed := 1 + Random(3);
// Img.Picture := ...
// Img.TopLeft := FindeFreienPlatz;
FImages.Add(Img);
end;
procedure TForm1.DeleteImage(Img: TMyImage);
begin
FImages.Extract(Img);
Img.Free;
end;
procedure TForm1.MoveImages;
var
i: Integer;
Img: TMyImage;
begin
for i := FImages.Count - 1 downto 0 do
begin
Img := FImages[i];
if Img.StartTime <= Now then
begin
Img.Top := Img.Top + Img.Speed;
if Image.Top > ClientHeight then
DeleteImage(Img);
end;
end;
end;