Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Method to display captions over time


bluemoon
 Share

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

Link to comment
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()`.

Link to comment
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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...