smdu57 Posted May 9, 2017 Share Posted May 9, 2017 Hello I use Phaser.text in my game. I want to align the text so I use text.anchor.set(0.5). On my small text it work fine but on my biggest text it make it blurry I read on forum to use text.anchor.x = Math.round(text.width * 0.5); but it only make my text disappear Is there an other way to do or maybe I'm doing it wrong question = game.add.text(310,180,questions[nbalea], {fontSize: '32px', fill: '#000' }); question.anchor.set(0.5); question.anchor.x = Math.round(question.width * 0.5); Thank you Link to comment Share on other sites More sharing options...
mcolman Posted May 9, 2017 Share Posted May 9, 2017 anchor is a value between 0 and 1, so based on the width of the text object that would send it off screen. try `question.pivot.x = Math.round(question.width * 0.5);` instead of anchor. Abhishek Singhal and smdu57 2 Link to comment Share on other sites More sharing options...
mcolman Posted May 9, 2017 Share Posted May 9, 2017 you can also set `question.autoRound = true` which will round the text position to a full pixel and hence the text won't have sub-pixel aliasing which causes the blurriness. Link to comment Share on other sites More sharing options...
smdu57 Posted May 9, 2017 Author Share Posted May 9, 2017 Thank you qestion.autoRound = true don't work as I wanted but question.pivot.x = Math.round(question.width * 0.5); work perfectly. I just added statement for vertical alignement using height and everything work. Link to comment Share on other sites More sharing options...
Recommended Posts