xronn Posted February 11, 2014 Share Posted February 11, 2014 Hey, Is there a z-index type function I can add to a sprite because I have the following code, but my title is hidden behind my background I can tell because when I comment my background the title is shown; this.add.sprite(10, 10, 'title'); this.add.sprite(100, 100, 'playButton', this.startGame); this.background = this.add.sprite(0, 0, 'menuBackground'); this.load.image('title', 'assets/imgs/titles.png'); this.load.image('playButton', 'assets/imgs/playButton.jpg'); this.load.image('menuBackground', 'assets/imgs/menuBackground.png');Thanks! Link to comment Share on other sites More sharing options...
XekeDeath Posted February 11, 2014 Share Posted February 11, 2014 Add the background first. The display order is the add order.There is a way to rearrange sprites, but I don't have time to delve into the docs to find it at the moment, and it may only be part of a group. Link to comment Share on other sites More sharing options...
xronn Posted February 11, 2014 Author Share Posted February 11, 2014 Aha I thought it loaded the other way, thanks! Link to comment Share on other sites More sharing options...
imshag Posted February 11, 2014 Share Posted February 11, 2014 You can either arrange your add orderORuse bringToTop() which you should use. docs: http://docs.phaser.io/Phaser.Sprite.html#toc53 Link to comment Share on other sites More sharing options...
Recommended Posts