new ObjectLayer( [config])
Parameters:
| Name | Type | Argument | Description |
|---|---|---|---|
config |
Phaser.Types.Tilemaps.ObjectLayerConfig |
<optional> |
The data for the layer from the Tiled JSON object. |
- Since: 3.0.0
- Source: src/tilemaps/mapdata/ObjectLayer.js (Line 10)
Members
-
name :string
-
The name of the Object Layer.
Type:
- string
- Since: 3.0.0
- Source: src/tilemaps/mapdata/ObjectLayer.js (Line 34)
-
objects :Array.<Phaser.Types.Tilemaps.TiledObject>
-
An array of all objects on this Object Layer.
Each Tiled object corresponds to a JavaScript object in this array. It has an
id(unique),name(as assigned in Tiled),type(as assigned in Tiled),rotation(in clockwise degrees),properties(if any),visiblestate (trueif visible,falseotherwise),xandycoordinates (in pixels, relative to the tilemap), and awidthandheight(in pixels).An object tile has a
gidproperty (GID of the represented tile), aflippedHorizontalproperty, aflippedVerticalproperty, andflippedAntiDiagonalproperty. The Tiled documentation contains information on flipping and rotation.Polylines have a
polylineproperty, which is an array of objects corresponding to points, where each point has anxproperty and ayproperty. Polygons have an identically structured array in theirpolygonproperty. Text objects have atextproperty with the text's properties.Rectangles and ellipses have a
rectangleorellipseproperty set totrue.Type:
- Since: 3.0.0
- Source: src/tilemaps/mapdata/ObjectLayer.js (Line 88)
-
opacity :number
-
The opacity of the layer, between 0 and 1.
Type:
- number
- Since: 3.0.0
- Source: src/tilemaps/mapdata/ObjectLayer.js (Line 43)
-
properties :object
-
The custom properties defined on the Object Layer, keyed by their name.
Type:
- object
- Since: 3.0.0
- Source: src/tilemaps/mapdata/ObjectLayer.js (Line 52)
-
propertyTypes :object
-
The type of each custom property defined on the Object Layer, keyed by its name.
Type:
- object
- Since: 3.0.0
- Source: src/tilemaps/mapdata/ObjectLayer.js (Line 61)
-
type :string
-
The type of the layer, which should be
objectgroup.Type:
- string
- Since: 3.0.0
- Source: src/tilemaps/mapdata/ObjectLayer.js (Line 70)
-
visible :boolean
-
Whether the layer is shown (
true) or hidden (false).Type:
- boolean
- Since: 3.0.0
- Source: src/tilemaps/mapdata/ObjectLayer.js (Line 79)
