News:

Building a 3D Ray Tracer  By stevmjon

Main Menu

Loading Exported Play Mapper Mini Levels

Started by kevin, February 18, 2008, 07:18:52 AM

Previous topic - Next topic

kevin

 This snippet is an example of how you can load Exported Layers from PlayMapper Mini into PB using the standard map extension library.   This library comes with PB and is in your Slib folder.

Note: You'll obviously need you're own export Level files to test this snippet !

 
PlayBASIC Code: [Select]
   #include "Maps"

Map=NewMap(10)

Filename$=path$+"MyLevels.PBLevel"


if Fileexist(Filename$)
fh=GetFreeFile()
readfile filename$,fh

; run through this file and load all of the levels stored in it
while not EndOfFile(fh)
ThisLevel=GetFreeMapLevel(Map)
Status=ReadLevelFromFile(fh,Map,ThisLevel)
if Status=true
print "Loaded Level"+Str$(ThisLevel)
print "Width:"+Str$(GetLEvelWidth(map,ThisLevel))
print "Height:"+Str$(GetLEvelWidth(map,ThisLevel))
endif
inc LevelsLoaded
endwhile
closefile fh
endif

print LevelsLoaded

Sync
Waitkey





Related LInks

   Load Play Mapper Maps

   Play Mapper (Work In Progress thread)