Nirvana2D [RCBasic Doc]

## Nirvana2D API

## TILE MAP

Type Nirvana_TileMap

- Dim TilesetName$
- Dim Tileset_ID
- Dim TileMap_ID
- Dim Mask_Index
- Dim Mask_Count

Function Nirvana_CreateTileMap(tset_name$, tmap_width, tmap_height) As Nirvana_TileMap

- Create a Nirvana TileMap

## TILE LAYER PROPERTIES

Function Nirvana_GetLayerTileSetName$(layer_index)

- Returns the name of tileset associated with the given layer or empty string if layer is not valid

Function Nirvana_GetLayerTileSetID(layer_index)

- Returns the RCBasic tileset associated with the given Nirvana layer or -1 if layer is not valid

Function Nirvana_GetLayerTileMapID(layer_index)

- Returns the RCBasic tile map associated with the given layer or -1 if layer is not valid

## TILE MASK

Function Nirvana_GetLayerTileMaskCount(layer_index)

- Returns the number of tile mask on a layers tileset

Function Nirvana_GetLayerTileMaskIndex(layer_index, mask_num)

- Returns the Nirvana tile mask index for the given mask number in a layer or -1 if not a valid layer or mask number
  - mask_num should be a number from 0 to Nirvana_GetLayerTileMaskCount(layer_index)-1

Function Nirvana_GetTileMaskName$(mask_index)

- Returns the name of the given tile mask or an empty string if the mask index is not valid

Function Nirvana_GetTileMaskMatrix(mask_index)

- Returns the RCBasic matrix id of the given mask or -1 if the mask is not valid

Function Nirvana_GetLayerMaskHit(layer_index, mask_index, x, y)

- Returns TRUE if the tile at the given position is flagged in the given mask
  - NOTE: (x, y) is a world position and not a row/column position in the tile map

## SET/GET TILES

Function Nirvana_GetTile(layer_index, x, y)

- Return the tile index of the tile at the given map position
  - NOTE: (x, y) is a row/colum position and not a world position in the tile map

Function Nirvana_GetTileMapPosition(layer_index, stage_x, stage_y) As Nirvana_Vector2D

- Return a Nirvana_Vector2D object with the row/column position of the tile at the absolute world position in the layer
  - NOTE: (x, y) is a world position and not a row/column position in the tile map

Function Nirvana_SetTile(layer_index, tile_index, x, y)

- Sets the tile at the given row/column position in the tile map for the layer
  - NOTE: (x, y) is a row/column position in the tile map