Deathspike Posted May 22, 2015 Share Posted May 22, 2015 I have a Phaser.TilemapLayer that I want to bring to the front. I fill it like this. for (let layerData of map.layers) { let layer = map.createLayer(layerData.name); if (layerData.name === 'collisionLayer') layer.visible = false; if (layerData.name === 'detailLayer') this._detailLayer = layer; layer.resizeWorld(); }Then, according to the TypeScript definitions I can do:this._detailLayer.bringToTop();This does not work (bringToTop does not exist). When I do this:this.world.bringToTop(this._detailLayer);The code will work, but TypeScript definitions specify this is not correct. What is the correct approach? Link to comment Share on other sites More sharing options...
Deathspike Posted May 29, 2015 Author Share Posted May 29, 2015 Bumping this up in the hopes of someone seeing this. Link to comment Share on other sites More sharing options...
Deathspike Posted June 3, 2015 Author Share Posted June 3, 2015 Bumping this up in the hopes of someone seeing this. Link to comment Share on other sites More sharing options...
Skeptron Posted June 5, 2015 Share Posted June 5, 2015 I think the best approach is to put everything into a group, and give things within the group a z-index. This should work with everything (map layers, sprites etc.) Check this : https://phaser.io/docs/2.3.0/Phaser.Group.html#addAt Link to comment Share on other sites More sharing options...
Recommended Posts