My code :
sync on:sync rate 45
set window on:set window size 500,500
open to read 1,"map.txt"
read string 1, s$
TilesX = val(s$)
read string 1, s$
TilesY = val(s$)
dim TileMap(TilesX,TilesY)
for row = 1 to TilesY
read string 1,s$
for col = 1 to TilesX
value = read byte from file ("map.txt",col)
Tilemap(row, col) = value
next col
next row
close file 1
set text size 20
for row=1 to TilesY
for col=1 to TilesX
posx=10*col:posy=10*row
s$=str$(Tilemap(row,col))
text posx,posy,s$
sync
next col
next row
wait key
My map file :
25
25
5555555555555555555555555
5555555555555555555555555
0000000000000000000000055
0000000000000000000000055
5500555555555555555500055
5500555555555555555500055
5500550000000000000000000
5500550000000000000000000
5500550055555555500550055
5500550055555555500550055
5500550055555555500550055
5500550055555555500550055
5500550055555555500550055
5500550055555555500550055
5500550055555555500550055
5500550055555555500550055
5500550055555555500550055
5500550000000000000550055
5500550000000000000550055
5500555555555555555550055
5500555555555555555550055
5500000000000000000000055
5500000000000000000000055
5555555555555555555555555
5555555555555555555555555
1. I am unable to perform the read and print. I guess I have goofed up someplace. Could someone please help me find out my mistake?
2. How would I go about this, if instead of numbers in the map, I used characters? (say 'X' instead of '5' and a 'blank space' instead of '0')
Thank you very much for the anticipated help,
-filya
-- game dev is fun...but taking up too much time --