ClearLevel
ClearLevel MapIndex, LevelIndex, TileIndex
 
Parameters:

    MapIndex = The Index Identifier of the Map you wish to alter this level within.
    LevelIndex = The index of the level you wish to resize.
    TileIndex = The Index of the Gfx tile that your wish to fill this level with
Returns: NONE
 

      ClearLevel will fill an enitre level with a particular tile.



FACTS:


      * None



Mini Tutorial:


      This example shows how to first create a Map & Level. Then while displaying the the level the mouse position (much like a sprite) it uses ClearLevel to randomly change then Tiles in this level.



  
; Set Width & Height variables of the Map tiles
  TileWidth=16
  Tileheight=16
  
; Get a free Map index
  MyMap=GetFreeMap()
  
; Create a map with provision for 5 levels
  CreateMap MyMap,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
  CreateLevel MyMap,1,20,20
  
  
; Start of Do/Loop
  Do
     
   ; Clear the screen to black
     Cls RGB(30,50,20)
     
   ; If a rand is greater then 900
     If Rnd(1000)>900
      ; Then, Randomly fill the level with the same tile
        ClearLevel MyMap,1,Rnd(10)
     EndIf
     
   ; Draw Level #1 of MyMap to the screen at mouses position
     DrawMap MyMap,1,MouseX(),MouseY()
     
   ; Display a Message
     Print "Clear Level Example"
     
   ; Display the screen and loop back to the DO
     Sync
  Loop
  
  


This example would output.

  
  no Text Output
  

 
Related Info: PeekLevelTile | PokeLevelTile | ResizeLevel :
 


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