FillLevel
FillLevel MapIndex, LevelIndex, X1, Y1, X2, Y2, TileIndex
 
Parameters:

    MapIndex = The Index Identifier of the Map you wish to alter a level within.
    LevelIndex = The index of the level you wish to fill.
    X1 = The Starting X (top left) coord in the level map
    Y1 = The Starting Y (top left) coord in the level map
    X2 = The Ending X (bottom right) coord in the level map
    Y2 = The Ending Y (bottom right) coord in the level map
    TileIndex = The Index of the Gfx tile that your wish to fill this level with
Returns: NONE
 

FillLevel lets the user fill a rectangular portion of a level with a particular tile. You can think of this line drawn a box of tiles onto a level.



FACTS:


* The region coords will be automatically clipped to the level size.



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 FillLevel to randomly change a region of Tiles witin 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
     Cls RGB(30,50,20)
     
   ; If random is greater then 900
     If Rnd(1000)>900
        
      ; Then, Randomly fill 2 regions within level
        FillLevel MyMap,1,2,2,9,9,Rnd(10)
        FillLevel MyMap,1,11,2,18,9,Rnd(10)
        
      ; fill 2 more regions within level
        FillLevel MyMap,1,2,12,9,19,Rnd(10)
        FillLevel MyMap,1,11,12,18,19,Rnd(10)
        
     EndIf
     
   ; Draw Level #1 of MyMap to the screen at mouses position
     DrawMap MyMap,1,MouseX(),MouseY()
     
   ; Display a Message
     Print "Fill Level Example"
     
   ; Display the screen and loop back to the DO
     Sync
  Loop
  
  
  
  


This example would output.

  
  no Text Output
  

 
Related Info: ClearLevel | PeekLevelTile | PokeLevelTile | ResizeLevel :
 


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