GetMapBlk
GetMapBlk MapIndex, BlockIndex, Xpos, Ypos
 
Parameters:

    MapIndex = The Index Identifier of the Map you wish to grab blocks to.
    BlockIndex = The index of the Block you wish to grab.
    Xpos = The X coordinate where to grab this block from
    Ypos = The Y coordinate where to grab this block from
Returns: NONE
 

      GetMapBlk allows the user to grab an region of the screen or image as an Block.



FACTS:


      * You can't use GetMapBlk until the map has either had space for block created, or some blocks loaded.

      * GetMapBlk uses the Width/Height sizes of the block as defined with the LoadMapGfx or CreateMapGfx commands.



Mini Tutorial:


      This example creates a map and uses the GetMapBlk to create a simple coloured block set, then displays them using the DrawMapBlk command.


  
; Set Width & Height variables of the Map tiles
  TileWidth=16
  Tileheight=16
  
; 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)
  
  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
  
; Draw the created blocks to the Screen
  For lp =0 To GetMapBlocks(MyMap)
     DrawMapBlk MyMap,lp,lp*TileWidth,100,0
  Next
  
; Display the screen and wait for a key press
  Sync
  WaitKey
  



This example would output.

  
  no Output
  

 
Related Info: CreateMap | CreateMapGfx | DrawMapBlk | LoadMapGfx | MakeMapGfx :
 


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