* ReadLine has a bug where it does not find the end of file. In my case this caused an endless loop. As a work around you may want to add "END" to the end of your text files. Something similar to the following code should do the trick...
Code:
procedure LoadLevel( aLevel : string );
var
res : resource;
line : string;
begin
// Levels
res := OpenResource( '/' + aLevel + '.txt' );
if (resourceAvailable(res)) then
begin
line := ReadLine(res) ;
iCounterY := 0;
while line <> 'END' do
begin
// Populate the Array
for iCounterX := 0 to MAP_WIDTH do
begin
end;
// Read Next line
line := ReadLine(res);
iCounterY := iCounterY + 1;
end;
CloseResource(res);
end;
end;
Bookmarks