A couple of questions about text

Non-platform specific questions.

A couple of questions about text

Postby HitoV » Sat Oct 15, 2011 4:13 am

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!
HitoV
 
Posts: 48
Joined: Sat Aug 27, 2011 8:22 am
Score: 3 Give a positive score

Re: A couple of questions about text

Postby Hblade » Sat Oct 15, 2011 4:17 am

Default Text: 00000000
then:
Code: Select all
textNumber=Score;
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: A couple of questions about text

Postby skydereign » Sat Oct 15, 2011 5:20 am

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.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: A couple of questions about text

Postby HitoV » Sat Oct 15, 2011 6:45 am

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!
HitoV
 
Posts: 48
Joined: Sat Aug 27, 2011 8:22 am
Score: 3 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest