CreateMapGfx
CreateMapGfx MapIndex, TileWidth, TileHeight, NumbOfTiles, TransparentColour, [Format=1]
 
Parameters:

    MapIndex = The Index Identifier of the Map you wish to assign these tiles gfx to.
    TileWidth = The Width in pixels of the tiles
    TileHeight = The Height in pixels of the tiles
    NumbOfTiles = The number of tiles to create
    TransparentColour = The transparent colour (in RGB fromat) to use for these tiles.
    [Format=1] = The image format of graphical blocks (1=Video, 2= FX, 4 = AFX)
Returns: NONE
 

      CreateMapGfx creates and assigns a set of tile graphics to a map. These tiles will be blank upon creation. The tiles will be of uniform size (width & height) and quantity you specify.

[
      The CreateMapGfx command also requires the tiles transparent colour in [link]RGB[/link] format. This colour is used as the transparency mask when drawing transparent levels. This effect is commonly used when two (or more) levels need to be drawn over each other to create multi layer parallax effects. Setting this value incorrectly, will no doubt result in your level not rendering with the correct transparency.

      Once you have created a set of tiles for your map, you can then individually grab Tile graphics from the screen or images as you see fit, using the GetMapBlk command.

      Block Formats:

1 = Video Memory (1024 max blocks)
2 = FX (4096 max blocks)
4 = AFX (Supports Alpha Channel & 4096 max blocks)





FACTS:


      * There's no limited upon the size(width/height) of the Tiles. You are only limited by the amount of Video Memory in your computer.

      * Also see LoadMapGFX & MakeMapGFX




Mini Tutorial:


      This example Creates a Map, then manually builds a tiled image, just so it can import it and finally build and display it


  
; First We'll create a Map
  MyMap = NewMap(1)
  
; Set some variables for the Size and number of blocks
  
  TileWidth=32
  TileHeight=32
  Number_of_tiles = 5
  
; Now we pre-create a set of "BLANK tiles" within this map.
  
  CreateMapGFX MyMAP,TileWidth,TileHeight,Number_Of_Tiles,RGB(0,0,0)
  
  
  
; Next, we'll  maunally build a series of randomly coloured
; blocks in a row to the screen.  We'll then grab these blocks
; as an image, so we can import them into our Map above.
  
  
; Loop through and draw a series of randomly coloured
; Boxes to the screen
  For lp=1 To Number_of_tiles-1
     BoxC 0,0,TileWidth,TileHeight,1,RndRGB()
     
   ; Grab this section of the screen as a TILE in this map
     GetMapBlk MyMap,lp,0,0
  Next
  
  
;   Now we have a Map that has a set of tiles ready for use
;  in it, so the next thing we need to is create a level.  This
;  is done with the CREATELEVEL command.  Which requires two
;  things, it needs the know within what MAP this level should
;  be created, and what Level Index it should for this level.
  
  
; Create level 1 in MyMAP, 100 tile across and 200 tiles down.
  CreateLevel MyMap,1100,200
  
  
;  We're just about ready now to start drawing, but first we need
; to fill the level with what tiles it should draw.  In this example,
; the following code will randomly fill the level.  Normally you
; would use a level editing program like PLAY MAPPER for such things.
; But your welcome to do it manually if you like.
  
  For Ylp=0 To GetLevelHeight(mymap,1)-1
     For Xlp=0 To (GetLevelWidth(MyMap,1)-1)
        PokeLevelTile MyMap,1,Xlp,ylp,Rnd(number_of_tiles-1)
     Next xlp
  Next ylp
  
; Draw the Level to the screen at Xpos 0 and Ypos 50
  DrawMap MyMap,1,0,50
  
; Show the user te screen and wait for a key to be pressed
  Sync
  WaitKey
  
  
  




 
Related Info: DrawMapBlk | GetMapBlk | LoadMapGfx | MakeMapGfx :
 


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