Sign in to follow this  
bluemoon

Method to display captions over time

Recommended Posts

Hey there, I'm really new to Pixijs. I'm planning to develop something which will require text captions displaying over time (think banjo kazooie, spyro, pokemon, etc etc). 

Does pixi already provide some way of doing this? I wouldn't mind doing it but I don't wanna reinvent the wheel.

 

Thx in advance for the help guys

Share this post


Link to post
Share on other sites

Sorry , what? 

You can use pixi-display if you want to add something in one container but display in the other, that can be used for HP-bars and captions. The problem is that it will have the scale of parent and its rotation, but you can make your own Transform class (see pixi.js src/display/Transform) that ignores it and re-define element transform `sprite.transform = new MyTransform()`.

Share this post


Link to post
Share on other sites

Oh, that thing. I've seen how people do it. The trick is to create a Text element and then use pair of sprites to show it partially. When you call `text.updateText()` it updates base texture, and then when you use `new PIXI.Texture(text.texture, new PIXI.Rectangle(x,y,w,h))` it creates a region of texture. You can hack Text class so it also gives you necessary widths for those regions.

I recommend to create your own Text, extend container, and add text and sprites for each line to it.

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.