CloneLevel
CloneLevel SrcMapIndex, SrcLevelIndex, DestMapIndex, DestLevelIndex
 
Parameters:

    SrcMapIndex = The Index of the Src Map you wish to copy level from
    SrcLevelIndex = The source index of the level you wish to copy.
    DestMapIndex = The Index of the Map you wish to copy the level data to
    DestLevelIndex = The destination index of the level where you wish to copy.
Returns: NONE
 

     CloneLevel copies an entire level.



FACTS:


      * If the destination level already exists, CloneLevel will delete and overwrite it for you.



Mini Tutorial:


      This example shows how to first create a Map & Level. Then after displaying the the created level #1, at the mouse position (much like a sprite). It then clones level #1 and displays that also.



  
; Set Width & Height variables of the Map tiles
  TileWidth=16
  Tileheight=16
  
  
; Create map with provision for 5 levels
  MyMap=NewMap(5)
  
; Create some empty graphics blocks for MyMAP
  CreateMapGFX MyMap,TileWidth,TileHeight,10,RGB(0,0,0)
  
  For lp=1 To 10
   ; draw a randomly coloured box
     BoxC 0,0,TileWidth-1,TileHeight-1,1,RndRGB()
   ; Copy the box image into MyMap
     GetMapBlk MyMap, lp, 0,0
  Next
  
; Create level 1 within MyMap
  CreateLevel MyMap,1,20,20
  
; Start of Do/Loop
  Do
     
   ; Clear the screen
     Cls RGB(30,50,20)
     
   ; Fill the Copy corner of this level with
   ; random tiles
     For ylp =0 To GetLevelHeight(MyMap,1)
        For xlp =0 To GetLevelWidth(MyMap,1)
           PokeLevelTile MyMap,1,xlp,ylp,Rnd(10)
        Next
     Next
     
   ; Clone level #1 from myMap to LEvel index 2 in mymap
     CloneLevel MyMap,1,MyMap,2
     
     
   ; Draw Level #1 of MyMap to the screen at mouses position
     DrawMap MyMap,1,MouseX(),MouseY()
     
   ; Draw level #2 of MyMap to 100x,100y
     DrawMap MyMap,2,100,100
     
     
   ; Display a Message
     Print "Clone Level Example"
     
   ; Display the screen and loop back to the DO
     Sync
  Loop
  
  


This example would output.

  
  no Text Output
  

 
Related Info: ClearLevel | CopyLevel | CreateMap | FillLevel | PeekLevelTile | PokeLevelTile | ResizeLevel :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com