Class: TMXTileMap

me. TMXTileMap

new TMXTileMap(levelId, data)

a TMX Tile Map Object Tiled QT +0.7.x format
Parameters:
Name Type Description
levelId String name of TMX map
data Object TMX map in JSON format
Source:
TMXTiledMap.js, line 125
Example
// create a new level object based on the TMX JSON object
var level = new me.TMXTileMap(levelId, me.loader.getTMX(levelId));
// add the level to the game world container
level.addTo(me.game.world, true);

Extends

Members

cols :Int

width of the tilemap in tiles
Type:
  • Int
Source:
TMXTiledMap.js, line 143

name :String

name of the tilemap
Type:
  • String
Source:
TMXTiledMap.js, line 129

rows :Int

height of the tilemap in tiles
Type:
  • Int
Source:
TMXTiledMap.js, line 150

tileheight :Int

Tile height
Type:
  • Int
Source:
TMXTiledMap.js, line 166

tilewidth :Int

Tile width
Type:
  • Int
Source:
TMXTiledMap.js, line 158

Methods

<static> getRenderer(layer) → {me.TMXRenderer}

Return the map default renderer
Parameters:
Name Type Argument Description
layer me.TMXLayer <optional>
a layer object
Source:
TMXTiledMap.js, line 218
Returns:
a TMX renderer
Type
me.TMXRenderer

addTo(target, flatten)

add all the map layers and objects to the given container
Parameters:
Name Type Description
target me.Container container
flatten boolean if true, flatten all objects into the given container
Source:
TMXTiledMap.js, line 323
Example
// create a new level object based on the TMX JSON object
var level = new me.TMXTileMap(levelId, me.loader.getTMX(levelId));
// add the level to the game world container
level.addTo(me.game.world, true);

destroy()

destroy function, clean all allocated objects
Source:
TMXTiledMap.js, line 503

getLayers() → {Array.<me.TMXLayer>}

return all the existing layers
Source:
TMXTiledMap.js, line 490
Returns:
Array of Layers
Type
Array.<me.TMXLayer>

getObjects(flatten) → {Array.<me.Renderable>}

return an Array of instantiated objects, based on the map object definition
Parameters:
Name Type Description
flatten boolean if true, flatten all objects into the returned array,
ignoring all defined groups (no sub containers will be created)
Source:
TMXTiledMap.js, line 362
Returns:
Array of Objects
Type
Array.<me.Renderable>