Jump to content

New Line Not Working With WordWrap


piman01
 Share

Recommended Posts

I am trying to make a quest log for my game. I have a javascript object called activeQuests with keys being quest names and values being quest descriptions. For example, we might use

activeQuests={

"quest1": "this is what you do in the first quest",

"quest2": "this is what you do in the second quest"

}

In my menu scene, I use the following code:

gameState10.activeQuestDisplay = this.add.text(175, 140, '', {
      fontSize: '25px',
      fill: '#fff',
      wordWrap: {
        width: 850,
        useAdvancedWrap: true
      }
    }).setOrigin(0, 0);
    let textFiller='';
    for (questTitle of Object.keys(activeQuests)) {
      textFiller += `${questTitle}: ${activeQuests[questTitle]}\n\n`
    };
    gameState10.activeQuestDisplay.setText(`${textFiller}`);

 

However, the two new lines (which should be present from \n\n) do not appear. Is this an issue with wordWrap? I've looked for quite awhile and can not seem to find a solution.

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...