bluemoon Posted November 7, 2017 Share Posted November 7, 2017 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 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 7, 2017 Share Posted November 7, 2017 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()`. Quote Link to comment Share on other sites More sharing options...
bluemoon Posted November 7, 2017 Author Share Posted November 7, 2017 I want this: And thanks, I'll look into what you mentioned. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 7, 2017 Share Posted November 7, 2017 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. bluemoon 1 Quote Link to comment Share on other sites More sharing options...
bluemoon Posted November 7, 2017 Author Share Posted November 7, 2017 Thanks a lot! You've given me a great starting point, If come up with something good, I'll post it here so more people can find it. Again, thx =) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.