Ziiiii Ziiiii - 9 months ago 88
Java Question

Libgdx display text/score as actor on stage

I would like to display multiple texts/scores on my stage. This tutorial suggested SpriteBatch, however, the issue is that these texts won’t fade out (not actor). Certain posts suggested use table, but the issue is that I can’t set texts' position on stage. Is there any other way to display texts as an actor on stage without using table?

Thanks in advance.

Answer Source

You can create a subclass of actor and draw text as you like in it's overridden draw method.

Just don't forget to set alpha before drawing using setColor method. The value of alpha will be available as a parameter for draw.
You then can fade it the way you want.

Good luck.