twoshorts Posted February 19, 2014 Share Posted February 19, 2014 I was looking around for a way to bring text to front, as whenever I try to make text, and then create a new thing over the text, the text is no longer visible. I am currently going out of the way to put the text into a group and then bring the group to top, but this is a huge inconvenience to do for every text object. Is there some method I don't know about that I can use for bringing text to the top? Or what is the common practice for doing this? Link to comment Share on other sites More sharing options...
rich Posted February 19, 2014 Share Posted February 19, 2014 I'm afraid there isn't a clean way to do this in Phaser 1.1, but I did add Text.bringToTop() to Phaser 1.2 if you can hold out a couple of weeks. Link to comment Share on other sites More sharing options...
XekeDeath Posted February 19, 2014 Share Posted February 19, 2014 Why not have a permanent group that is on top of everything and add all the text to that one as you create them?I set my games up to use multiple groups as display layers://General idea, not my actual code...backGroup = game.add.group();spriteGroup = game.add.group();textGroup = game.add.group();guiGroup = game.add.group(); Link to comment Share on other sites More sharing options...
rich Posted February 19, 2014 Share Posted February 19, 2014 Or, as Xeke said Link to comment Share on other sites More sharing options...
twoshorts Posted February 19, 2014 Author Share Posted February 19, 2014 Allright this will do for now. Going to be waiting on that update daily now Link to comment Share on other sites More sharing options...
Heppell08 Posted February 21, 2014 Share Posted February 21, 2014 Well trust me to find a post i need help on and its in an update haha. Sure im stalking Rich with his dev of phaser haha. Anyway Xekes method i will use.Was having a bit of an issue with bringing text back above the tilemap after a level switch. Link to comment Share on other sites More sharing options...
KevinnFtw Posted May 27, 2014 Share Posted May 27, 2014 I'm afraid there isn't a clean way to do this in Phaser 1.1, but I did add Text.bringToTop() to Phaser 1.2 if you can hold out a couple of weeks. Hey Rich, I'm using Phaser 2.0.5, but there's no such option to bring text to the front/top. I also couldn't find it in the latest docs. Do I have to put all the text elements in a group and bring that to top or is there any other way? Thanks. Link to comment Share on other sites More sharing options...
stauzs Posted May 28, 2014 Share Posted May 28, 2014 Hey Rich, I'm using Phaser 2.0.5, but there's no such option to bring text to the front/top. I also couldn't find it in the latest docs. Do I have to put all the text elements in a group and bring that to top or is there any other way? Thanks. Hi, I had similar problem - at the moment I use as workaround: ...text.parent.bringToTop(text);... Link to comment Share on other sites More sharing options...
rich Posted June 5, 2014 Share Posted June 5, 2014 Yeah I didn't add it directly in the end because there are several ways of doing it: Either from the parent property, or from the World if that is what the Text is a child of (world.bringToTop(textThing)). Link to comment Share on other sites More sharing options...
Recommended Posts