Textnumber

Learn how to make certain types of games and use gameEditor.

Textnumber

Postby BogdansB » Mon Jul 02, 2012 12:34 pm

Hey,
This maybe a stupid question but how can i make a text show "1-3" without calculating so there stands 1-3 and not -2 :S

i used

Code: Select all
if (weapon==1)
{
damage_text.textNumber=1-3;

}


but doesn't works
and when i try to use .text he gives an error "cannot convert from´const double´ to ´ARY[256]char´"
BogdansB
 
Posts: 94
Joined: Tue Oct 25, 2011 2:30 pm
Score: 0 Give a positive score

Re: Textnumber

Postby tzoli » Mon Jul 02, 2012 1:18 pm

It's easy. First: the '-' caracter is not a number(it's an operator) so you have to write in the text variable.
You have to know that you can't define strings with that method you use to define integers.(Incorrect:weapon_text.text="blablabla";)
You have to use the SPRINTF command.
Code: Select all
if (weapon==1)
{
sprintf(damage_text.text,"1-3");

}
Creepers are capable of climbing ladders, despite lacking arms. (Minecraft wiki)
User avatar
tzoli
 
Posts: 343
Joined: Sat Jun 12, 2010 6:54 pm
Location: Behind you
Score: 15 Give a positive score

Re: Textnumber

Postby BogdansB » Mon Jul 02, 2012 3:26 pm

thanks :D
BogdansB
 
Posts: 94
Joined: Tue Oct 25, 2011 2:30 pm
Score: 0 Give a positive score

Re: Textnumber

Postby tzoli » Mon Jul 02, 2012 3:30 pm

You are welcome :D
Creepers are capable of climbing ladders, despite lacking arms. (Minecraft wiki)
User avatar
tzoli
 
Posts: 343
Joined: Sat Jun 12, 2010 6:54 pm
Location: Behind you
Score: 15 Give a positive score


Return to Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest