Skip to content

Commit

Permalink
Tilemap.layer is a getter/setter to the current layer object (which c…
Browse files Browse the repository at this point in the history
…an be changed with Tilemap.setLayer)
  • Loading branch information
photonstorm committed May 15, 2014
1 parent 1d13855 commit cfadaf3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ Version 2.0.5 - "Tanchico" - in development
* Mouse.mouseOutCallback callback added for when the mouse is no longer over the game canvas.
* Mouse.stopOnGameOut boolean controls if Pointer.stop will be called if the mouse leaves the game canvas (defaults to false)
* Tilemap.searchTileIndex allows you to search for the first tile matching the given index, with optional skip and reverse parameters.
* Tilemap.layer is a getter/setter to the current layer object (which can be changed with Tilemap.setLayer)


### New Plugins
Expand Down
23 changes: 23 additions & 0 deletions src/tilemap/Tilemap.js
Original file line number Diff line number Diff line change
Expand Up @@ -1743,3 +1743,26 @@ Phaser.Tilemap.prototype = {
};

Phaser.Tilemap.prototype.constructor = Phaser.Tilemap;

/**
* @name Phaser.Tilemap#layer
* @property {number|string|Phaser.TilemapLayer} layer - The current layer object.
*/
Object.defineProperty(Phaser.Tilemap.prototype, "layer", {

get: function () {

return this.layers[this.currentLayer];

},

set: function (value) {

if (value !== this.currentLayer)
{
this.setLayer(value);
}

}

});

0 comments on commit cfadaf3

Please sign in to comment.