Any Suggestions? A Text with center alignment

I am developing a game and I don’t like my score text behaves for example.

I have reached a score of:
________
|145235 |
and I want it to appear like this,
________
| 145235 |

keeping it centered. I have used widget.newText() but it’s orientation is Left to Right
Any suggestions?

Thanks [import]uid: 225774 topic_id: 36382 reply_id: 336382[/import]

I removed the duplicate post.

Can you post your text creation and text updating code?
It’s pretty simple. Update the text, do a textobject:setReferencePoint(display.CenterReferencePoint) then set the textobject.x to the center you desire.
[import]uid: 199310 topic_id: 36382 reply_id: 144484[/import]

First, you need to get a fixed-width font. You can find several with a web search. That will get rid of the jumpy text you see when you have 1’s appear and disappear from your score.

Second, do you want the text [ 123344 } to always be centered to the same point on the screen so that it grows in both directions, or only grow to the right?

Centered, grows in both directions:

scoreboardText = display.newText("[" .. tostring(score) .. "]", ...)  
scoreboardText.x = 200  

Left justified, grows to the right:

scoreboardText = display.newText("[" .. tostring(score) .. "]", ...)  
scoreboardText.x = 200 + scoreboardText.width\*0.5  

[import]uid: 58455 topic_id: 36382 reply_id: 144487[/import]

I haven’t though of doing setting a reference point to my score text. Maybe I should try it. Thanks! [import]uid: 225774 topic_id: 36382 reply_id: 144488[/import]

Thanks dave for the suggestion. I will be up for it!

I wanted my text to stay on its point and if 1 appears it grows on both sides. [import]uid: 225774 topic_id: 36382 reply_id: 144489[/import]

I removed the duplicate post.

Can you post your text creation and text updating code?
It’s pretty simple. Update the text, do a textobject:setReferencePoint(display.CenterReferencePoint) then set the textobject.x to the center you desire.
[import]uid: 199310 topic_id: 36382 reply_id: 144484[/import]

First, you need to get a fixed-width font. You can find several with a web search. That will get rid of the jumpy text you see when you have 1’s appear and disappear from your score.

Second, do you want the text [ 123344 } to always be centered to the same point on the screen so that it grows in both directions, or only grow to the right?

Centered, grows in both directions:

scoreboardText = display.newText("[" .. tostring(score) .. "]", ...)  
scoreboardText.x = 200  

Left justified, grows to the right:

scoreboardText = display.newText("[" .. tostring(score) .. "]", ...)  
scoreboardText.x = 200 + scoreboardText.width\*0.5  

[import]uid: 58455 topic_id: 36382 reply_id: 144487[/import]

I haven’t though of doing setting a reference point to my score text. Maybe I should try it. Thanks! [import]uid: 225774 topic_id: 36382 reply_id: 144488[/import]

Thanks dave for the suggestion. I will be up for it!

I wanted my text to stay on its point and if 1 appears it grows on both sides. [import]uid: 225774 topic_id: 36382 reply_id: 144489[/import]

I removed the duplicate post.

Can you post your text creation and text updating code?
It’s pretty simple. Update the text, do a textobject:setReferencePoint(display.CenterReferencePoint) then set the textobject.x to the center you desire.
[import]uid: 199310 topic_id: 36382 reply_id: 144484[/import]

First, you need to get a fixed-width font. You can find several with a web search. That will get rid of the jumpy text you see when you have 1’s appear and disappear from your score.

Second, do you want the text [ 123344 } to always be centered to the same point on the screen so that it grows in both directions, or only grow to the right?

Centered, grows in both directions:

scoreboardText = display.newText("[" .. tostring(score) .. "]", ...)  
scoreboardText.x = 200  

Left justified, grows to the right:

scoreboardText = display.newText("[" .. tostring(score) .. "]", ...)  
scoreboardText.x = 200 + scoreboardText.width\*0.5  

[import]uid: 58455 topic_id: 36382 reply_id: 144487[/import]

I haven’t though of doing setting a reference point to my score text. Maybe I should try it. Thanks! [import]uid: 225774 topic_id: 36382 reply_id: 144488[/import]

Thanks dave for the suggestion. I will be up for it!

I wanted my text to stay on its point and if 1 appears it grows on both sides. [import]uid: 225774 topic_id: 36382 reply_id: 144489[/import]

I removed the duplicate post.

Can you post your text creation and text updating code?
It’s pretty simple. Update the text, do a textobject:setReferencePoint(display.CenterReferencePoint) then set the textobject.x to the center you desire.
[import]uid: 199310 topic_id: 36382 reply_id: 144484[/import]

First, you need to get a fixed-width font. You can find several with a web search. That will get rid of the jumpy text you see when you have 1’s appear and disappear from your score.

Second, do you want the text [ 123344 } to always be centered to the same point on the screen so that it grows in both directions, or only grow to the right?

Centered, grows in both directions:

scoreboardText = display.newText("[" .. tostring(score) .. "]", ...)  
scoreboardText.x = 200  

Left justified, grows to the right:

scoreboardText = display.newText("[" .. tostring(score) .. "]", ...)  
scoreboardText.x = 200 + scoreboardText.width\*0.5  

[import]uid: 58455 topic_id: 36382 reply_id: 144487[/import]

I haven’t though of doing setting a reference point to my score text. Maybe I should try it. Thanks! [import]uid: 225774 topic_id: 36382 reply_id: 144488[/import]

Thanks dave for the suggestion. I will be up for it!

I wanted my text to stay on its point and if 1 appears it grows on both sides. [import]uid: 225774 topic_id: 36382 reply_id: 144489[/import]