LevelSolid
LevelSolid MapIndex, LevelIndex
 
Parameters:

    MapIndex = The Index Identifier of the Map you wish to alter a levels render mode within
    LevelIndex = The index of the level you wish to set to solid
Returns: NONE
 

      LevelSolid sets a levels rendering mode to solid. In solid mode, the level tiles will be drawn with no transparency applied.




FACTS:


      * Solid mode rendering is generally faster than transparent mode, except when the transparent level is very sparse.

      * Solid mode can be combined with animation mode.





Mini Tutorial:


      This example creates a map and basic level, and then draws solid and transparent versions of this level at the mouse pointers current position.


  
  
  
; Set Width & Height variables of the Map tiles
  TileWidth=20
  Tileheight=20
  
; Create a 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)
  Cls RGB(0,0,0)
  For lp=1 To 9
   ; draw a randomly coloured box
     BoxC 0,0,TileWidth/2,TileHeight/2,1,RndRGB()
   ; Copy the box image into MyMap
     GetMapBlk MyMap, lp, 0,0
  Next
  
  
; Create level 1
  CreateLevel MyMap,1,10,10
  
; Randomly Fill the level with Tiles
  For Ylp=0 To GetLevelWidth(myMap,1)
     For Xlp=0 To GetLevelWidth(myMap,1)
        PokeLevelTile MyMap,1,Xlp,Ylp,RndRange(1,10)
     Next
  Next
  
; Make a copy of level 1 as level 2
  CloneLevel MyMap,1,MyMap,2
  
; Set Level #1 as solid
  LevelSolid MyMap,1
  
; Set Level #2 as transparent, using tile 0 null tile
  LevelTransparent MyMap,2,0
  
  
; Start of Do/Loop
  Do
   ; clear the screen to black
     Cls RGB(255,20,30)
     
     
   ; Read the mouse position
     mx#=MouseX()
     my#=MouseY()
     
     
   ; Draw Level #1
     DrawMap MyMap,1,mx#-200,my#-100
     CenterText mx#-100,my#-120,">> SOLID MAP <<"
     
   ; DRaw the Level #2
     DrawMap MyMap,2,mx#+200,my#-100
     CenterText mx#+300,my#-120,">> TRANSPRENT MAP <<"
     
   ; Display the screen and loop back to the DO
     Sync
  Loop
  
  



This example would output.

  
  no Text Output
  

 
Related Info: CreateLevel | CreateMap | DrawMap | GetLevelDrawMode | LevelDrawMode | LevelTransparent :
 


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