ganz klarer logikfehler
Wenn es rot wird, ist der timer aus.
dann ist doch klar, dass onTimer nicht ausgeführt wird und somit der timer gar nichtmehr enabled wird
Lösung:
nicht den timer ausschalten, sondern nur:
Delphi-Quellcode:
if shgruen1.Visible=true then
begin
imAuto1.Top:=imAuto1.Top-1;
end;
Verstanden?
-------------------------------------
Änder deine tiAuto1Timer prozedur einfach so(habs getestet und es geht)
Delphi-Quellcode:
procedure TForm1.tiAuto1Timer(Sender: TObject);
begin
if (shgruen1.Visible=true) AND (not shgelb1.Visible=true) then
begin
imAuto1.Top := imAuto1.Top-1
end else
if shrot1.Visible=true AND (not shgelb1.Visible=true) then
begin
if imAuto1.Top = 330 then
imAuto1.Top := imAuto1.Top
else
imAuto1.Top := imAuto1.Top-1;
end;
if imAuto1.Top = -40 then
begin
imAuto1.Top := 400;
end;
end;
Noch was:
Warum arbeitest du mit so vielen Shapes?
Mach doch einfach immer
shampel1.brush.color := clRed;
etc.