unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm2 =
class(TForm)
Shape1: TShape;
Button1: TButton;
Button2: TButton;
Button3: TButton;
SRot : TShape;
SGelb : TShape;
SGruen : TShape;
Timer1 : TTimer;
procedure Button3Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
Phase: Integer;
Zeit: Integer;
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.Button1Click(Sender: TObject);
begin
case Phase
of
1:
begin
SRot.Brush.Color:= clRed;
SGelb.Brush.Color:= clBlack;
SGruen.Brush.Color:= clBlack;
Phase:= Phase + 1;
end;
2:
begin
SRot.Brush.Color:= clRed;
SGelb.Brush.Color:= clYellow;
SGruen.Brush.Color:= clBlack;
Phase:= Phase + 1;
end;
3:
begin
SRot.Brush.Color:= clBlack;
SGelb.Brush.Color:= clBlack;
SGruen.Brush.Color:= clGreen;
Phase:= Phase + 1;
end;
4:
begin
SRot.Brush.Color:= clBlack;
SGelb.Brush.Color:= clYellow;
SGruen.Brush.Color:= clBlack;
Phase:= 1
end;
end;
end;
procedure TForm2.FormCreate(Sender: TObject);
begin
Phase:= 1;
Zeit:= 1;
end;
{ Rr }
procedure TForm2.Button3Click(Sender: TObject);
begin
close;
end;
procedure TForm2.Timer1Timer(Sender: TObject);
begin
begin
Zeit:= Zeit + 1;
case Zeit
of
1..5 : Phase:= 1;
6 : Phase:= 2;
7..11: Phase:= 3;
12 :
begin
Phase:= 4;
Zeit:= 0;
end;
end;
end;
end;
end.