2D Map Saving/Loading

Blitz3D Forums/Blitz3D Beginners Area/2D Map Saving/Loading

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Something like this ... sorry not tested - just typed into the post ..


Function SaveMap()

  Count = 0
  for t.tile = each tile
    Count = Count + 1
  next

  mapout = writefile( "Blah" )
  writeint( mapout, count )
  for t.tile = each tile
    writeint( mapout, t\xnum)
    writeint( mapout , t\ynum)
    writeint( mapout, t\mode )
  next

  closefile mapout



function LoadMap()

  mapin = readfile( "Blah" )
  count = readint( mapin )
  for l = 1 to count
      t.tile = new tile
      t\xnum = readint( mapin)
      t\ynum = readint( mapin)
      t\mode = readint( mapin)
  next

  closefile mapin

end function