Constructor
new Tilemap()
Creates a new Tilemap object.
- Source:
- See:
Members
(readonly) back :rune.tilemap.TilemapLayer
Reference to the Tilemap's rear buffer, i.e. the bottom layer in the layer
hierarchy. Note that DisplayObjects placed on the stage are rendered on top
of this buffer.
Type:
- Source:
(readonly) front :rune.tilemap.TilemapLayer
Reference to the Tilemap's front buffer, i.e. the top layer in the layer
hierarchy. Note that this layer is rendered on top of both the
DisplayObjects placed on the stage, as well as the Tiles included in the
back buffer.
Type:
- Source:
(readonly) heightInTiles :number
The height of the tile map, given in number of tiles.
Type:
- number
- Source:
(readonly) name :string
The name of the current map. The name is retrieved from the map data
(JSON) when the map is loaded. If no name is declared in the map data,
the name of the map data file is used as the name.
Type:
- string
- Source:
(readonly) numTiles :number
The total number of Tiles included in the current map.
Type:
- number
- Source:
(readonly) texture :HTMLImage
Reference to the texture the map uses for its Tiles.
Type:
- HTMLImage
- Source:
(readonly) tileHeight :number
The height of a Tile, given in pixels.
Type:
- number
- Source:
(readonly) tileWidth :number
The width of a Tile, given in pixels.
Type:
- number
- Source:
(readonly) width :number
The current width of the map, specified in pixels.
Type:
- number
- Source:
(readonly) widthInTiles :number
The width of the tile map, given in number of tiles.
Type:
- number
- Source:
Methods
clear() → {undefined}
Resets the map.
- Source:
Returns:
- Type
- undefined
getBlock(v) → {rune.tilemap.Block}
Creates and returns a new Block object based on a tile value. The method
can be used to generate tiles represented by Sprite objects.
Parameters:
Name | Type | Description |
---|---|---|
v |
number | Tile value. |
- Source:
Returns:
- Type
- rune.tilemap.Block
getTilePropertiesOf(v) → {Object}
Returns a key-value pair that describes the properties of a
Tile, via the specified Tile value. The method returns
null if the specified Tile value is not associated with
properties in the map data.
Parameters:
Name | Type | Description |
---|---|---|
v |
number | Tile value. |
- Source:
Returns:
- Type
- Object
getTileTextureRectOf(v) → {rune.geom.Rectangle}
Returns a rectangle object that describes a value's location in the
texture atlas. The method is mainly intended for internal use,
but can be useful if you want to copy a "piece" of the texture atlas.
Parameters:
Name | Type | Description |
---|---|---|
v |
number | Tile value. |
- Source:
Returns:
- Type
- rune.geom.Rectangle
load(name) → {undefined}
Loads a map from map-data.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the resource that represents the map data. |
- Source:
Throws:
Error In case of corrupt map data.
Returns:
- Type
- undefined