twoshorts

Bringing text to front

Recommended Posts

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?

Share this post


Link to post
Share on other sites

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();

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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);...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.