Cocos Creator API

1.4.x

Cocos Creator is a highly customizable game development tool that utilizes the power of cocos2d-x.

TiledMap

Extends Component
Module: cc

Renders a TMX Tile Map in the scene.

Properties

tmxAsset TiledMapAsset

The TiledMap Asset.

__eventTargets Array private

Inherited from Component:

Register all related EventTargets, all event callbacks will be removed in _onPreDestroy

node Node

Inherited from Component:

The node this component is attached to. A component is always attached to a node.

examples:

cc.log(comp.node);

uuid String readOnly

Inherited from Component:

The uuid for editor.

examples:

cc.log(comp.uuid);

_enabled Boolean private

Inherited from Component:

enabled Boolean

Inherited from Component:

indicates whether this component is enabled or not.

examples:

comp.enabled = true;
cc.log(comp.enabled);

enabledInHierarchy Boolean readOnly

Inherited from Component:

indicates whether this component is enabled and its node is also active in the hierarchy.

examples:

cc.log(comp.enabledInHierarchy);

_isOnLoadCalled Boolean readOnly

Inherited from Component:

TODO

examples:

cc.log(_isOnLoadCalled);

_name String private

_objFlags Number private

name String

The name of the object.

examples:

obj.name = "New Obj";

isValid Boolean readOnly

Indicates whether the object is not yet destroyed.

examples:

cc.log(obj.isValid);

There are no properties that match your current filter settings. You can change your filter settings in the index section on this page. index

Methods

getMapSize ( ) Size

Gets the map size.

returns:

type: Size

examples:

var mapSize = tiledMap.getMapSize();
cc.log("Map Size: " + mapSize);

setMapSize
(
  • mapSize
)

Set the map size.

name type description
mapSize Size

examples:

tiledMap.setMapSize(new cc.size(960, 640));

getTileSize ( ) Size

Gets the tile size.

returns:

type: Size

examples:

var tileSize = tiledMap.getTileSize();
cc.log("Tile Size: " + tileSize);

setTileSize
(
  • tileSize
)

Set the tile size.

name type description
tileSize Size

examples:

tiledMap.setTileSize(new cc.size(10, 10));

getMapOrientation ( ) Number

map orientation.

returns:

type: Number

examples:

var mapOrientation = tiledMap.getMapOrientation();
cc.log("Map Orientation: " + mapOrientation);

setMapOrientation
(
  • orientation
)

map orientation.

name type description