LevelTransparentTile
LevelTransparentTile MapIndex, LevelIndex, TransparentTile
 
Parameters:

    MapIndex = The Index of the Map
    LevelIndex = The index of the level you wish to set the transparent tile in
    TransparentTile = The Index of a totally transparent block to ignore.
Returns: NONE
 
     LevelTransparentTile sets a levels primary transparent tile.

      This transparent tile parameter is the index of a block that is known to be completely clear. Since we know this block is clear, then it doesn't make sense for it to be drawn, Since it's a waste of valuable processing time. Thus we screen the block out entirely, so basically the transparent DrawMap routines will ignore these blocks completely.

      Since PlayBASIC V1.64N, the mapping system gives map blocks three different transparent classifications, those being completely solid, partly transparent and completely transparent. The blocks are classified as you manually grab them (ie GetMapBlk) or as they're imported though commands like LoadMapGfx and MakeMapGFx. This allows the draw map routines to not only ignore our primary tile, but any completely transparent tile.





FACTS:


      * Since the V1.64N upgrade of PlayBASIC, the usefulness of LevelTransparentTile has been somewhat diminished, even so, we still recommend setting a transparent block.



Mini Tutorial:


      This example creates a maps level, and then draws the solid and transparent versions of this level at the mouse pointers current position, as if the level was a sprite.


  
; Set Width & Height variables of the Map tiles
  TileWidth=20
  Tileheight=20
  
; 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)
  Cls RGB(0,0,0)
  For lp=1 To 10
   ; 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
  LevelDrawMode MyMap,1,%001
  
; Set LEvel #2 as transparent
  LevelDrawMode MyMap,2,%010
  
; Set the transparent tile to tile zero
  LevelTransparentTile 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 Output
  

 
Related Info: GetLevelDrawMode | GetLevelTransparentTile | LevelAnimated | LevelDrawMode | LevelSolid | LevelTransparent :
 


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