Paragraph issues

Hi, I’m trying to write a paragraph on my options page, but it keeps coming out weird. The sentence won’t go across the page I tried align left, center, right, but it’s not working.

I also wrote out the code these 2 ways, no luck.

local textObj = display.newText(“The game is to get the ball from one Bar\n,”…" to the next Bar", 0, 20, native.systemFont, 17)
textObj:setFillColor(0, 0, 0)
textObj.x = display.contentCenterX + 5
textObj.y = display.contentCenterY + 50


local options =
{
text = “The game is to get the ball from one Bar\n,”…" to the next Bar",
x = 150,
y = 225,
width = 800,
font = native.systemFont,
fontSize = 17,
align = “center”,
}

local myText = display.newText( options )
myText:setFillColor( 0, 0, 0 )

What did I do wrong? Thanks

Is the newline (\n) right before the comma intentional?

The text is in fact centered, it is your coordinates that are not in the center.

Try using:

x =  display.contentWidth*0.5
y = display.contentHeight*0.5
1 Like

Remember that the texts are independent boxes that has the same behavior as any other display.object, so you have these variables:

The alignment only aligns the text inside that box. You can change the size of that box by setting the width and the height, otherwise it is going to adjust to its minimum possible size.

@Luem Also, why are you concatenating the two text segments? Try this instead:

text = “The game is to get the ball from one Bar to the next Bar",