Autor Beitrag
umpani
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 389



BeitragVerfasst: Mi 04.08.04 20:06 
So wie ich es die gesagt habe, mu0 die Datei level.txt wirklich 11 Zeien mir exakt 11 Zeichen pro zeile haben. Wenn du nur 3 Zeilen hast, versucht es hinter dem Dateiende zu lesen.
Gruß Umpani

_________________
Lernen, ohne zu denken, ist eitel; denken, ohne zu lernen, ist gefährlich. Konfuzius
breakdancer1111 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 148

Windows 7 Home Premium 64Bit
Delphi XE2 Starter
BeitragVerfasst: Do 05.08.04 10:39 
Irgendwie bekomm ich das nicht auf die Reihe. :(
Ich hab die Datei noch einmal in den Anhang gepackt.

www.citybreaker.de/dowbloads/2dArray.rar
umpani
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 389



BeitragVerfasst: Do 05.08.04 11:11 
War mein Fehler!
So ist das richtig.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
  assignfile(datei,'level.txt');
  reset(datei);

  for x := 0 to 1 do
  begin
    Readln(datei,s);                    //Das muß in der schleife liegen
    for y := 0 to 10 do begin
      level[x,y] := StrToInt(s[y+1]);   //Achte auf das y+1 !!!!
      if level[x,y] = 0 then
        DxImageList1.Items[0].Draw(DxDraw1.Surface,x*32,y*32,0);
    end;
  end;
  CloseFile(datei);


Gruß Umpani

_________________
Lernen, ohne zu denken, ist eitel; denken, ohne zu lernen, ist gefährlich. Konfuzius
breakdancer1111 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 148

Windows 7 Home Premium 64Bit
Delphi XE2 Starter
BeitragVerfasst: Do 05.08.04 18:08 
-- Edit --
Ein Problem gelöst nächstes ist da.
Irgendwie wird alles verdreht unzwar ist
0 = schnee
1 = fels

Wenn ich
00000
11111
habe dann sind die Felsen an der rechten Seite.
Bei
00001
00001
wären die Felsen erst unten. Kann man das noch
irgendwie anders machen?

Ich hab jetzt 14 tiles wie soll man denn das im code zu erkennen
geben. z.B.
10000 = 1 fels und schnee
10000 = 10 fels1 und schnee
mimi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3458

Ubuntu, Win XP
Lazarus
BeitragVerfasst: Sa 07.08.04 19:54 
ich weiß jetzt zwar nicht wo der fehler ist aber ich würde es einfach so machen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
procedure LoadLevel(F:TFileNAme);
var
  LEvel:TStringList
  x,y:Integer;
  Str:String;
begin
  Level:=TStringList.Create;
  for x:=0 to MAPX do begin
    for y:=0 to MAPY do begin
      Str:=Level.Strings[y];
      Map[x,y].typ:=StrToINt(Str[x]);
    end;
  end;
end;

so würde ich es machen *G*

_________________
MFG
Michael Springwald, "kann kein englisch...."