Page 1 of 1

A couple of questions about text

PostPosted: Sat Oct 15, 2011 4:13 am
by HitoV
Hello again,

Ive got 2 quick questions on text,

1. Is there any method for centering text? It always aligns it to the first character and this makes it really hard for me to achieve some certain menu type things I want to do.

2. Second, I know I saw this in a thread a while back but cannot find it. How can I get a text actor to display a score with 0's filled in.

ie:
score: 00000120

rather then:
score: 120


If anyone could help I would greatly appreciate it!

Re: A couple of questions about text

PostPosted: Sat Oct 15, 2011 4:17 am
by Hblade
Default Text: 00000000
then:
Code: Select all
textNumber=Score;

Re: A couple of questions about text

PostPosted: Sat Oct 15, 2011 5:20 am
by skydereign
You can do that, or use text and sprintf.
Code: Select all
sprintf(text, "SCORE: %010d", score);

This sets the text to say score, and the score with up to 10 leading zeros. For centering text, you can format text with sprintf (something like "20%s", or if it is a single text actor, you can just set the position so the text appears centered.

Re: A couple of questions about text

PostPosted: Sat Oct 15, 2011 6:45 am
by HitoV
Thanks! They both work perfect!

I was trying to center one text actor's text who is constantly changing. Since its never longer then 7 letters though I suppose formatting the chars with spaces makes perfect sense and is a super easy fix. Thanks again fellas!