Autor Beitrag
-delphin-
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 200



BeitragVerfasst: Fr 22.07.05 17:24 
Warum zeigt der mir hier den Fehler mit inkompatiblen Typen an??

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
  If (abs(IEnemy.Left-IFigure.Left)<50) and (abs(IEnemy.Top-IFigure.Top<50)) then
  begin
    showmessage('Sie haben leider verloren!');
    Timer1.Enabled:=false;
  end;


.Left und .Top sind Integer Werte... kann man die vll nicht subtrahieren??
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: Fr 22.07.05 17:26 
Kann es daran liegen, dass Delphi bei Abs Real-Typen erwartet?

AXMD
SMO
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 120
Erhaltene Danke: 18


D2005 Personal
BeitragVerfasst: Fr 22.07.05 17:34 
Es gibt auch eine Version von Abs für Integer-Typen, daran liegt es also nicht.
Ich würde mal sagen, du hast den zweiten Ausdruck falsch geklammert. Ersetze mal
(abs(IEnemy.Top-IFigure.Top<50))
durch
(abs(IEnemy.Top-IFigure.Top)<50)
;)
-delphin- Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 200



BeitragVerfasst: Fr 22.07.05 17:34 
nein, abs kann real oder auch integer sein
-delphin- Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 200



BeitragVerfasst: Fr 22.07.05 17:36 
joa jetz passts =) thx