Text input centered
Posted:
Thu May 22, 2014 12:01 pm
by JoeLopez
Hi I am trying to create a scenario in which a user types text into a speech bubble. I am hoping to format it so that as the user types, the text starts a new line in specific places (or after a specific number of characters) so that the text stays inside the bubble. Can anyone help me?? Loving game editor btw.
Re: Text input centered
Posted:
Mon Jun 09, 2014 11:18 am
by foleyjo
Does your speech bubble have a set size and will each line in the speech bubble be different sized?
If set sized bubble you could have each line of the speach bubble as a different string.
Set a pointer to the firstline string and everytime the user inputs a character amend the string until you have reached the maximum number of characters.
Now set the pointer to the secondline string and repeat until all string lines have been maxed out.
Only thing that this won't deal with is when words are split over two lines. Maybe instead of doing it by letter you could do it by word. (using space character to check when the word is entered) and then compare the length of the new word with the spaces left in the current lines string. If the new word is greater then move onto the next line.