Class: TMXLayer

me. TMXLayer

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

a TMX Tile Layer Object Tiled QT 0.7.x format
Parameters:
Name Type Description
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
Source:
TMXLayer.js, line 366

Extends

Members

alpha :Number

Define the renderable opacity
Set to zero if you do not wish an object to be drawn
Type:
  • Number
Inherited From:
Default Value:
  • 1.0
Source:
renderable.js, line 151
See:
  • me.Renderable#setOpacity
  • me.Renderable#getOpacity

ancestor :me.Container

a reference to the Container object that contains this renderable, or undefined if it has not been added to one.
Type:
Inherited From:
Default Value:
  • undefined
Source:
renderable.js, line 163

isAnimated :Boolean

Layer contains tileset animations
Type:
  • Boolean
Source:
TMXLayer.js, line 412

tilesets :me.TMXTilesetGroup

The Layer corresponding Tilesets
Type:
Source:
TMXLayer.js, line 381

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)
Source:
TMXLayer.js, line 617
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
Source:
TMXLayer.js, line 523
Returns:
renderer
Type
me.TMXRenderer

<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)
Source:
TMXLayer.js, line 565
Returns:
corresponding tile or null if outside of the map area
Type
me.Tile
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)
Source:
TMXLayer.js, line 550
Returns:
TileId or null if there is no Tile at the given position
Type
Number

<static> setRenderer(renderer)

Se the TMX renderer for this layer object
Parameters:
Name Type Description
renderer me.TMXRenderer
Source:
TMXLayer.js, line 511

<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
Source:
TMXLayer.js, line 593
Returns:
the corresponding newly created tile object
Type
me.Tile
Copyright © 2011 - 2017, Olivier Biot, Jason Oster, Aaron McLeod
Documentation generated by JSDoc 3.4.0 on 2017-02-28T11:37:41+08:00 using the DocStrap template modified by codename-.