Jump to content

Word wrap in Phaser 3+


JesusJoseph
 Share

Recommended Posts

I need to add a help content for the game.

I need to set word wrap for the help content. 

In version 2 I use below code to set word wrap. But in version 3 its not working

helpText.setTextBounds(16, 20, 768, 568);

Can someone please tell me how to set word wrap in Phaser 3 

Thanks for your help

Full Code below

var helpContent = "Help Content Come here" + 
			"Help Content Come here" + 
"Help Content Come here";
		var style = { font: "24px Arial", align: "left", wordWrap: true, wordWrapWidth: 450 };
		var helpText = me.add.text(0, 50, helpContent, style);
		helpText.setTextBounds(16, 20, 768, 568);

 


 

Link to comment
Share on other sites

  • 4 weeks later...
On 6/15/2018 at 12:00 AM, squilibob said:

wordWrap is an object


        var style = = { 
            fontSize: 24,
            fontFamily: 'Arial',
            align: "left",
            wordWrap: { width: 450, useAdvancedWrap: true }
        }

 

 

On 6/15/2018 at 12:00 AM, squilibob said:

wordWrap is an object


        var style = = { 
            fontSize: 24,
            fontFamily: 'Arial',
            align: "left",
            wordWrap: { width: 450, useAdvancedWrap: true }
        }

it works thanks 

 

 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...