samjarman Posted July 3, 2014 Share Posted July 3, 2014 How do I set text box width and allow the text to wrap automatically? it seems fairly weird to have to put '\n's in everywhere, especially with text I don't define. Also, with the x and y in the constructor... is that top left, centre? centre top? The docs dont say as far as I can see :/ Cheers! Link to comment Share on other sites More sharing options...
samjarman Posted July 4, 2014 Author Share Posted July 4, 2014 Here is my full code with it all working, in case anyone is curious var information = this.game.add.text(10, 100, this.generateFeedback()); information.font = 'Open Sans'; information.wordWrap = true; information.wordWrapWidth = 790; //790 and 10 above to try do some padding information.align = 'center';//I thought this would cause all text to move to center, but only seems to work for one line. information.fontSize = 35; information.fill = '#FFFFFF'; titleText.anchor.setTo(0.5, 0); //centers text for one line Link to comment Share on other sites More sharing options...
Recommended Posts