-
In a game I'm working on, all of the levels are picture boxes named (tile) with an index array. There are (I think) 50 across by 50 tall. They will be assigned a texture, and whether or not aplayer can move across/on top of them by there tile(x).tag property. I was wondering, how I could make a file that would be simlar to this:
1,1,1,1,1,1
1,0,34,0,0,1
1,0,0,0,0,1
1,0,142,0,0,1
1,0,0,0,0,42,
1,1,1,1,1,1
And then load each number to the tile(x) property. Thanks a lot in advance for any help :)
-
Loop through each line, and split it up. Then put them into the right place in a 2D array. ie, use a tile(x,y)...or is it tile(x)(y)? That should help.
-
If you level is an array (the indexes) you can access the file binary like this:
Code:
Dim Level() as Long
'Initialize the level array
Redim level( 50, 50 )
'Write the array tro file
Open File for binary as 1
Put 1,, Level
Close 1
And to read:
Code:
'Read array from file, note that
'it has to be exact size as you
'saved it (50x50)
Open File for binary as 1
Get 1,, Level
Close 1