How to center text of text Object

The game I’m developing will be available to upto 11 languages but there is a issue:

If I write Skip in english in text object it looks great see
skip-english.PNG
but when I try to change the language to say German then skip looks like this as the length of characters increases
skip-german.PNG

1- So my question is that is there a why to center the text with in the limits like we write text in MS-word if we choose center the text starts writing from center instead of left or right.
2- Also text goes blurred when opened in some desktop browser
3-How to change the origin points of text like we do in images

Thanks,

To center a text object horizontally over X, after modifying the text’s string, set its x position to:

X - TextObject.Width()/2

as you would do to center any sprite with Origin at 0;0 :wink:

You can’t modify a text object Origin… I don’t know if you can do anything about the blurred text :neutral_face:

3 Likes

THANKS IT WORKS
obj[0].setX(160-(obj[0].getWidth()/2));
160 is screen centerX

for blurred text I think I should use HD fonts .tff

It’s long ago, but a more simple approach for me was using “put the object around another”. If you take your background object as center object with 0 distance, 0 angle it gets perfectly centered.

1 Like

thank you for sharing your reply this is really helpful for me..