AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren

Ampelschaltungen

Ein Thema von ValFar · begonnen am 31. Jan 2006 · letzter Beitrag vom 31. Jan 2006
 
ValFar

Registriert seit: 31. Jan 2006
3 Beiträge
 
Delphi 2005 Personal
 
#5

Re: Ampelschaltungen

  Alt 31. Jan 2006, 14:56
habe jetzte ma alles des drin gelassen was eigentlich funzt und alles das rausgenommen worüber ich mir im unklaren bin (Die Flächen zum abfragen der Ampelphasen sind noch enthalten):

Ausgehend von diesem Code benötige ich folgende Proceduren:
Das überprüfen der zzt. Ampelphase, Wechsel der Ampelphase abhängig vom Timer, Autos, abhängig von der Ampelphase.

Hier der Quellcode:

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Borland.Vcl.StdCtrls, Borland.Vcl.ExtCtrls,
System.ComponentModel;

type
TForm1 = class(TForm)
Street1: TShape;
Street2: TShape;
Timer1: TTimer;
Button1: TButton;
Car1: TShape;
Ampel1: TShape;
Rot1: TShape;
Gelb1: TShape;
green1: TShape;
Car3: TShape;
Car2: TShape;
Car4: TShape;
Ampel3: TShape;
Ampel4: TShape;
Ampel2: TShape;
Rot3: TShape;
Rot2: TShape;
Rot4: TShape;
Gelb3: TShape;
Gelb2: TShape;
Gelb4: TShape;
green4: TShape;
green2: TShape;
green3: TShape;
check4: TShape;
check3: TShape;
check2: TShape;
check1: TShape;
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.nfm}


procedure TForm1.Button1Click(Sender: TObject);
begin
close;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
Car1.Top := Car1.Top -2;
Car2.Top := Car2.top +2;
Car3.Left := Car3.Left +2;
Car4.Left := Car4.Left -2;

If Car1.Top = -24 then Car1.Top := 512;
If Car2.Top = 510 then Car2.Top := -48;
If Car3.Left = 712 then Car3.Left := -48;
If Car4.Left = -24 then Car4.Left := 712;


If Rot1.Brush.color = clred then Car1.Left := 0;
If green1.Brush.color = clred then Car1.Left := +2;
end;



end.
  Mit Zitat antworten Zitat
 

Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 12:58 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz