1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187:
| var Form1: TForm1; z:Byte; Ampel: TShape; v:INTEGER; v1:INTEGER; AmpelCount:Integer; freigabe:boolean;
implementation
procedure Wait(time: word); var Start: Integer; begin Start:=GetTickCount; while GetTickCount-Start <= time do application.ProcessMessages; end;
{$R *.dfm}
procedure TForm1.Beenden1Click(Sender: TObject); begin z:=1; close; end;
procedure TForm1.RotPhase; begin freigabe:=false; Canvas.pen.color:=clred; Canvas.Brush.Color:=clred; Canvas.Ellipse(100,100,170,170); Canvas.pen.color:=clolive; Canvas.Brush.Color:=clolive; Canvas.Ellipse(100,180,170,250); Canvas.pen.color:=$00273924; Canvas.Brush.Color:=$00273924; Canvas.Ellipse(100,260,170,330); end;
procedure TForm1.RotGelbPhase; begin freigabe:=false; Canvas.pen.color:=clred; Canvas.Brush.Color:=clred; Canvas.Ellipse(100,100,170,170); Canvas.pen.color:=clyellow; Canvas.Brush.Color:=clyellow; Canvas.Ellipse(100,180,170,250); Canvas.pen.color:=$00273924; Canvas.Brush.Color:=$00273924; Canvas.Ellipse(100,260,170,330); end;
procedure TForm1.GruenPhase; begin freigabe:=true; Canvas.pen.color:=$00000064; Canvas.Brush.Color:=$00000064; Canvas.Ellipse(100,100,170,170); Canvas.pen.color:=clolive; Canvas.Brush.Color:=clolive; Canvas.Ellipse(100,180,170,250); Canvas.pen.color:=clgreen; Canvas.Brush.Color:=clgreen; Canvas.Ellipse(100,260,170,330); end;
procedure TForm1.GelbPhase; begin freigabe:=true; Canvas.pen.color:=$00000064; Canvas.Brush.Color:=$00000064; Canvas.Ellipse(100,100,170,170); Canvas.pen.color:=clyellow; Canvas.Brush.Color:=clyellow; Canvas.Ellipse(100,180,170,250); Canvas.pen.color:=$00273924; Canvas.Brush.Color:=$00273924; Canvas.Ellipse(100,260,170,330); end;
procedure TForm1.AutoGo; begin z:=0; v:=4; v1:=4;
Form1.DoubleBuffered:=True;
Repeat
IF Auto.left>Form1.Width THEN BEGIN Auto.left:=1; END Else Auto.left:=Auto.left+v; Wait(0);
IF Auto1.left>Form1.Width THEN BEGIN Auto1.left:=1; END Else Auto1.left:=Auto1.left+v; Wait(0);
IF Auto2.left <=0 Then Begin Auto2.left:=Form1.Width; End Else Auto2.left:=Auto2.left-v; wait(0);
IF Auto3.top>Form1.Height then begin Auto3.top:=1; end Else Auto3.top:=Auto3.top+v; Wait(0);
IF Mann.top >Form1.Height Then Begin Mann.top:=1; End Else Mann.top:=Mann.top+1; wait(0); until z=1;
end;
procedure TForm1.AusClick(Sender: TObject); begin z:=1; end;
procedure TForm1.SchnellerClick(Sender: TObject); begin v:=v+1; v1:=v1+1; end;
procedure TForm1.langsamerClick(Sender: TObject); begin v:=v-1 ; if v<0 then v:=0;
v1:=v1-1; if v1<0 then v1:=0;
end;
procedure TForm1.Button4Click(Sender: TObject); begin z:=2; end;
procedure TForm1.Timer1Timer(Sender: TObject); begin If freigabe then AutoGo; end;
procedure TForm1.Timer2Timer(Sender: TObject); begin Ampelcount:=Ampelcount+1; if AmpelCount>10 then AmpelCount:=0; If (AmpelCount< 5) then RotPhase; If (AmpelCount>4) and (AmpelCount<6) then RotGelbPhase; If (Ampelcount>5) and (AmpelCount<9) then GruenPhase; If (Ampelcount>8) then GelbPhase; end;
end. |