me.TMXLayer(data, tilewidth, tileheight, orientation, tilesets, z)

new TMXLayer(data, tilewidth, tileheight, orientation, tilesets, z)

a TMX Tile Layer Object Tiled QT 0.7.x format

Parameters:
Name Type Description
data Object

layer data in JSON format (http://docs.mapeditor.org/en/stable/reference/tmx-map-format/#layer)

tilewidth Number

width of each tile in pixels

tileheight Number

height of each tile in pixels

orientation String

"isometric" or "orthogonal"

tilesets me.TMXTilesetGroup

tileset as defined in Tiled

z Number

z-index position

Extends

Members

alpha :Number

Define the renderable opacity
Set to zero if you do not wish an object to be drawn

Inherited From:
Default Value:
  • 1.0
See:
  • me.Renderable#setOpacity
  • me.Renderable#getOpacity

ancestor :me.Container|me.Entity

a reference to the parent object that contains this renderable

Inherited From:
Default Value:
  • undefined

isAnimated :Boolean

Layer contains tileset animations

renderorder :String

the order in which tiles on orthogonal tile layers are rendered. (valid values are "left-down", "left-up", "right-down", "right-up")

Default Value:
  • "right-down"

tilesets :me.TMXTilesetGroup

The Layer corresponding Tilesets

Methods

static clearTile(x, y)

clear the tile at the specified position

Parameters:
Name Type Description
x Number

X coordinate (in map coordinates: row/column)

y Number

Y coordinate (in map coordinates: row/column)

Example
me.game.world.getChildByType(me.TMXLayer).forEach(function(layer) {
    // clear all tiles at the given x,y coordinates
    layer.clearTile(x, y);
});

static getRenderer() → {me.TMXRenderer}

Return the layer current renderer object

Returns:
me.TMXRenderer -

renderer

static getTile(x, y) → {me.Tile}

Return the Tile object at the specified position

Parameters:
Name Type Description
x Number

X coordinate (in world/pixels coordinates)

y Number

Y coordinate (in world/pixels coordinates)

Returns:
me.Tile -

corresponding tile or null if outside of the map area

Example
// get the TMX Map Layer called "Front layer"
var layer = me.game.world.getChildByName("Front Layer")[0];
// get the tile object corresponding to the latest pointer position
var tile = layer.getTile(me.input.pointer.pos.x, me.input.pointer.pos.y);

static getTileId(x, y) → {Number}

Return the TileId of the Tile at the specified position

Parameters:
Name Type Description
x Number

X coordinate (in world/pixels coordinates)

y Number

Y coordinate (in world/pixels coordinates)

Returns:
Number -

TileId or null if there is no Tile at the given position

static setRenderer(renderer)

Se the TMX renderer for this layer object

Parameters:
Name Type Description
renderer me.TMXRenderer

static setTile(x, y, tileId) → {me.Tile}

Create a new Tile at the specified position

Parameters:
Name Type Description
x Number

X coordinate (in map coordinates: row/column)

y Number

Y coordinate (in map coordinates: row/column)

tileId Number

tileId

Returns:
me.Tile -

the corresponding newly created tile object