Autor Beitrag
death-adders
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 82

Vista
Turbo Delphi Explorer
BeitragVerfasst: So 31.12.06 17:04 
Hallo,
ich möchte in einer procedure den angezegten text eines Labels ändern undzwar wenn die variable y8=0 ist.
So hab ichs geschrieben:

procedure Gameover;
begin
if (y8<=0) then begin y8:=300;
form1.Canvas.Rectangle(x7,y7,x8,y8 );
Label1.Caption := 'Game Over!';
end;
end;

Wenn nun y8 aber 0 ist erscheint in dem Labelfeld nicht Game Over!.Warum?
Kroko
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1284

W98 W2k WXP
Turbo D
BeitragVerfasst: So 31.12.06 17:08 
(a) hier gibt es Code-Tags, einrücken ist auch nicht schlecht
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure Gameover;
begin
  if (y8<=0) then 
    begin 
      y8 := 300;
      form1.Canvas.Rectangle(x7,y7,x8,y8 );
      Label1.Caption := 'Game Over!';
  end;
end;


sieht doch gleich viel besser aus, oder
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure Gameover;
begin
  if (y8<=0) then 
    begin 
      form1.Canvas.Rectangle(x7,y7,x8,300 );
      Label1.Caption := 'Game Over!';
      Application.ProcessMessages;
  end;
end;


geht es so?

_________________
Die F1-Taste steht nicht unter Naturschutz und darf somit regelmäßig und oft benutzt werden! oder Wer lesen kann, ist klar im Vorteil!
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: So 31.12.06 17:08 
Bist du dir sicher, dass y8 = 0 ist? Warum denn <= ? Und formatiere deinen Code mal!
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure Gameover;
begin
   if (y8 = 0) then 
   begin
     y8:=300;
     form1.Canvas.Rectangle(x7,y7,x8,y8 );
     Label1.Caption := 'Game Over!';
   end;
end;

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
IngoD7
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 629


D7
BeitragVerfasst: So 31.12.06 18:22 
user profile iconMarco D. hat folgendes geschrieben:
Bist du dir sicher, dass y8 = 0 ist? Warum denn <= ?

[Vermutung ON]
Da es sich offensichtlich um ein Spiel handelt, wird es wahrscheinlich möglich sein, dass y8 auf einen Schlag auch unter 0 rutschen kann. Dann würde das natürlich Sinn machen.

... Auch - und da hast du recht - wenn das Eingangsposting von genau Null sprach. ...
[Vermutung OFF]