Autor Beitrag
G-McKree
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 178



BeitragVerfasst: Mo 19.05.03 13:33 
ausblenden Delphi-Quelltext
1:
2:
if (Bullets[i].Top < Blue.Top) and (Bullets[i].Top + 33 > Blue.top) 
and (Bullets[i].left < Blue.left) and (Bullets[i].left + 33 > Blue.Left) then

gilt nicht behauptet delphi. irgentwas von wegen ''loop, local variable'' ich brauche eure hilfe, sonst dreh ich durch

Moderiert von user profile iconUGrohne: Quote-Tags durch Delphi-Tags ersetzt
ErnestoChe
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 528

Win 2000 pro, CRUX 2.0
Delphi 6 Pers, Open K3
BeitragVerfasst: Mo 19.05.03 13:40 
Hi,

probiers mal so:
ausblenden Delphi-Quelltext
1:
2:
if (Bullets[i].Top < Blue.Top) and ((Bullets[i].Top + 33) > Blue.top) 
and (Bullets[i].left < Blue.left) and ((Bullets[i].left + 33) > Blue.Left) then


// Edit: müsste eigentlich auch so gehen, wie dus machst. poste am besten mehr code und die genaue Fehlermeldung und wo du deine variablen deklarierst und wie du sie initialisierst

MFG

- Ernesto -


Zuletzt bearbeitet von ErnestoChe am Mo 19.05.03 13:48, insgesamt 2-mal bearbeitet
UGrohne
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Veteran
Beiträge: 5502
Erhaltene Danke: 220

Windows 8 , Server 2012
D7 Pro, VS.NET 2012 (C#)
BeitragVerfasst: Mo 19.05.03 13:47 
Der Code ist in Ordnung, funktioniert bei mir einwandfrei (also wird kompiliert, die Logik hab ich außen vor gelassen).

Wie hast Du denn die Variablen deklariert?
G-McKree Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 178



BeitragVerfasst: Mo 19.05.03 20:47 
sehr interresant: gestern war die bedingung noch verboten undheute darf ich sie sogar schon kompilieren....typisch delphi
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
if (Bullets[i].Top < Blue.Top) and (Bullets[i].Top + 33 > Blue.top) 
and (Bullets[i].left < Blue.left) and (Bullets[i].left + 33 > Blue.Left) then
      begin
      Blue_Health:= Blue_Health - 25;

      if Blue_Health = 0 then
       begin
        Blue.Top:= 10;
       Blue.Left:= 74;
       end;

      actualize;
     end;

dieser tolle unsinn ist meine ''kolisionsabfrage'' ner kugel und nes panzers :D wenn das prog aber bis zu jemer tolle bedingung kommt gits so ne tolle ''access violation''

kommt das davon, das ein paar zeilen weiter oben das steht:
Zitat:
with Bullets[i] do
?

Moderiert von user profile iconTino: Delphi-Tags hinzugefügt.
ErnestoChe
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 528

Win 2000 pro, CRUX 2.0
Delphi 6 Pers, Open K3
BeitragVerfasst: Mo 19.05.03 20:59 
Hi,

G-McKree hat folgendes geschrieben:
kommt das davon, das ein paar zeilen weiter oben das steht:
Zitat:
with Bullets[i] do
?



Was hält dich ab es auszuprobieren und diese Zeile mal auszukommentieren?

Wenn du den kompletten Code der procedure posten würdest könnte man sicher besser helfen.

MFG

- Ernesto -
G-McKree Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 178



BeitragVerfasst: Mo 19.05.03 21:17 
wenn ich
Zitat:
for i:= 0 to 0 do

schreibe, dann ist
Zitat:
Bullets[i]

doch Bullets[0], oder?
ErnestoChe
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 528

Win 2000 pro, CRUX 2.0
Delphi 6 Pers, Open K3
BeitragVerfasst: Mo 19.05.03 21:27 
Hi,

ja, aber ganz langsam:

ausblenden Delphi-Quelltext
1:
for i:= 0 to 0 do					


wozu brauchst du dann eine for-Schleife?? :roll:

// Edit: beutze doch bitte Delphi Code-Tags um deinen Code zu markieren.
Quelltext markieren und den Delphi-Button betätigen.

MFG

- Ernesto -
G-McKree Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 178



BeitragVerfasst: Mo 19.05.03 21:34 
ErnestoChe hat folgendes geschrieben:
Hi,

ja, aber ganz langsam:

ausblenden Delphi-Quelltext
1:
for i:= 0 to 0 do					


wozu brauchst du dann eine for-Schleife?? :roll:


ich hab ein spiel. imspiel gibts panzer. panzer schießen projektile. und alle projektile heissen bullets[zahl]. projektile müssen sich bewegen. und damit sich alle projektile schön bewegen, werden sie ineine ''for'' schleife alle schön bewegt :D
ErnestoChe
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 528

Win 2000 pro, CRUX 2.0
Delphi 6 Pers, Open K3
BeitragVerfasst: Mo 19.05.03 21:41 
Hi,

aber hierbei

ausblenden Delphi-Quelltext
1:
for i := 0 to 0 do					


wird doch die schleife nur einmal durchlaufen. Da kannst du es gleich weglassen.

MFG

- Ernesto -
G-McKree Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 178



BeitragVerfasst: Mo 19.05.03 21:43 
ErnestoChe hat folgendes geschrieben:
Hi,

aber hierbei

ausblenden Delphi-Quelltext
1:
for i := 0 to 0 do					


wird doch die schleife nur einmal durchlaufen. Da kannst du es gleich weglassen.

MFG

- Ernesto -


eigentlich steht da
ausblenden Delphi-Quelltext
1:
for i := 0 to (variable) do					

aber zu der zeit wo der fehler auftritt, is (variable) 0
ErnestoChe
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 528

Win 2000 pro, CRUX 2.0
Delphi 6 Pers, Open K3
BeitragVerfasst: Mo 19.05.03 21:46 
jep. Sags doch gleich. :wink: