JamesA Posted March 10, 2018 Share Posted March 10, 2018 I'm just curious why whenever I append text to a text object it appears to go to the next line... For example: var chatText = game.add.text(0, 0, "Name: ", style); chatText.text += "hello I'm James" will appear in the game as: Name: hello I'm James Word wrap is disabled, if I display the text in the console it says Name: hello I'm James Thanks if you have any info. Link to comment Share on other sites More sharing options...
JamesA Posted March 10, 2018 Author Share Posted March 10, 2018 Does the same thing with .setText Link to comment Share on other sites More sharing options...
onlycape Posted March 10, 2018 Share Posted March 10, 2018 Hi, Maybe there is a problem with the style. This works perfectly in the on line Sandbox Phaser editor: function create() { var style = { font: "bold 32px Arial", fill: "#fff"}; var mytext = game.add.text(0, 0, 'My own text:', style); mytext.setText(mytext.text+' This is my text.'); var mytext2 = game.add.text(0, 50, 'My own text2:', style); mytext2.text+=' This is my text2.'; } Link to comment Share on other sites More sharing options...
Recommended Posts