totallybueno Posted June 13, 2014 Share Posted June 13, 2014 Hi there guys,I´m having a problem with align and bitmapText... and it seems that it´s not working (at least not for me) I guess this should be enough:this.marker= this.game.add.bitmapText(posX, posY, 'bloodyFont',"0", 85);this.marker.align = "right";But if I change "right" for "center" or "left", the result is exactly the same, nothing changes. At least I tried the angle property and it´s working perfectly, but align is not... do I need something else? Am I doing something wrong? Anyway, as I can´t get the width, I can´t do it "manually", so what should I do? Thanks in advance. Link to comment Share on other sites More sharing options...
totallybueno Posted June 13, 2014 Author Share Posted June 13, 2014 Ok, I just saw in the documentation that it´s just for multiline, it doesn´t affect single lines. Link to comment Share on other sites More sharing options...
lewster32 Posted June 13, 2014 Share Posted June 13, 2014 The alignment only works when the text is multi-line. It's not entirely intuitive that this is the case, but it is. If you need to align a single line of text I'm afraid you'll need to manually adjust its position every time you update it.this.marker.text = "Blah";this.marker.updateText(); // this is important to calculate the textWidth straight away rather than waiting until the next updatethis.marker.x = posX - this.marker.textWidth;Or if you want it centered:this.marker.x = posX - (this.marker.textWidth * 0.5); kidos and totallybueno 2 Link to comment Share on other sites More sharing options...
totallybueno Posted June 13, 2014 Author Share Posted June 13, 2014 Working perfectly, thanks dude! I didn´t see textWidth in the documentation... Thanks again Link to comment Share on other sites More sharing options...
lewster32 Posted June 13, 2014 Share Posted June 13, 2014 textWidth and updateText() are both properties in PIXI.BitmapText which Phaser's BitmapText inherits from. totallybueno 1 Link to comment Share on other sites More sharing options...
totallybueno Posted June 13, 2014 Author Share Posted June 13, 2014 Then I suposse I need to add Pixi´s documentation to my bookmarks too Thanks dude. Link to comment Share on other sites More sharing options...
lewster32 Posted June 13, 2014 Share Posted June 13, 2014 No problem Link to comment Share on other sites More sharing options...
Recommended Posts