A tile map is just a grid of images. I'd start off with an array that is the size of your map and then fill it with the images of each (x,y) location on your map. I'm using image 0 just to demonstrate. you of course would have to load your own images and use them.
// our array to hold the images of our map
dim map[25,25]
// make a random tile map
x# = 0
y# = 0
image = 0
for i = 1 to 25
for j = 1 to 25
sprite = CreateSprite( image )
SetSpriteSize( sprite, 4, 4 )
SetSpritePosition( sprite , x#, y# )
SetSpriteColor( sprite, random(1,255), random(1,255), random(1,255), 255)
x# = x# + 4
// store the sprite image number in our map array
map[i,j] = image
next i
x# = 0
y# = y# + 4
next j
do
sync()
loop
Then you can just write out the array to a file and back in later when you want load your map
function SaveMap()
MapFile = OpenToWrite ("Map.dat",0)
//save the map tile images
for i = 1 to 25
for j = 1 to 25
WriteInteger(MapFile, map[i,j] )
next j
next i
CloseFile(MapFile)
endfunction
function LoadMap()
MapFile = OpenToRead ("Map.dat")
//Read in the map tile images into our array
for i = 1 to 25
for j = 1 to 25
map[i,j] = ReadInteger(MapFile)
next j
next i
CloseFile(MapFile)
endfunction
Auger