File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -761,8 +761,9 @@ var Tile = new Class({
761761 } ,
762762
763763 /**
764- * The tileset that contains this Tile. This will only return null if accessed from a LayerData
765- * instance before the tile is placed within a StaticTilemapLayer or DynamicTilemapLayer.
764+ * The tileset that contains this Tile. This is null if accessed from a LayerData instance
765+ * before the tile is placed in a StaticTilemapLayer or DynamicTilemapLayer, or if the tile has
766+ * an index that doesn't correspond to any of the map's tilesets.
766767 *
767768 * @name Phaser.Tilemaps.Tile#tileset
768769 * @type {?Phaser.Tilemaps.Tileset }
@@ -773,7 +774,12 @@ var Tile = new Class({
773774 get : function ( )
774775 {
775776 var tilemapLayer = this . tilemapLayer ;
776- return tilemapLayer ? tilemapLayer . tileset : null ;
777+ if ( ! tilemapLayer ) return null ;
778+
779+ var tileset = tilemapLayer . gidMap [ this . index ] ;
780+ if ( ! tileset ) return null ;
781+
782+ return tileset ;
777783 }
778784 } ,
779785
You can’t perform that action at this time.
0 commit comments