Cocos Creator API

1.4.x

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

TiledLayer

Module: cc

Render the TMX layer.

Properties

__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

getLayerName ( ) String

Gets the layer name.

returns:

type: String

examples:

var layerName = tiledLayer.getLayerName();
cc.log(layerName);

SetLayerName
(
  • layerName
)

Set the layer name.

name type description
layerName String

examples:

tiledLayer.setLayerName("New Layer");

getProperty
(
  • propertyName
)
Any

Return the value for the specific property name.

name type description
propertyName String

returns:

type: Any

examples:

var property = tiledLayer.getProperty("info");
cc.log(property);

getPositionAt
(
  • pos
  • [y ]
)
Vec2

Returns the position in pixels of a given tile coordinate.

name type description
pos Vec2 | Number

position or x

y optional Number
<