UnderwareDESIGN

PlayBASIC => Resources => Source Codes => Topic started by: kevin on February 18, 2008, 07:18:52 AM

Title: Loading Exported Play Mapper Mini Levels
Post by: kevin on February 18, 2008, 07:18:52 AM
 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 !

 
[pbcode]

   #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

[/pbcode]


Related LInks

   Load Play Mapper Maps (http://www.underwaredesign.com/forums/index.php?topic=2539.0)

   Play Mapper (Work In Progress thread) (http://www.underwaredesign.com/forums/index.php?topic=2279.0)