Skip to content

Commit 1334914

Browse files
committed
Added Tile.tilemap convenience getter
1 parent 1f72b90 commit 1334914

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/gameobjects/tilemap/Tile.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,20 @@ var Tile = new Class({
554554
{
555555
return this.layer.tilemapLayer;
556556
}
557+
},
558+
559+
/**
560+
* The tilemap that contains this Tile. This will only return null if accessed from a LayerData
561+
* instance before the tile is placed within a StaticTilemapLayer or DynamicTilemapLayer.
562+
* @property {Tilemap|null} tilemap
563+
* @readonly
564+
*/
565+
tilemap: {
566+
get: function ()
567+
{
568+
var tilemapLayer = this.tilemapLayer;
569+
return tilemapLayer ? tilemapLayer.map : null;
570+
}
557571
}
558572
});
559573

0 commit comments

Comments
 (0)