views:

101

answers:

1

Hello!

I have an RPG in development, but I'm still confused about the best way to display dialogue.

I want there to be a text box with text that scrolls (like any RPG), but what is the best way to accomplish this using X-Code?

Thanks!

+1  A: 

You should use a UITextView and the scrollRangeToVisible method. As you browse methods don't forget it inherits from UIScrollView (so you can use UIScrollViewDelegate too) which has some really useful methods related to movement.

You could probably use just one UITextView in your app and manipulate the text/scrolling position as necessary. Using conventional animation all kinds of fades and effects are possible.

If you need colored text with various fonts you need to use UIWebView which does not inherit from UIScrollView but UIView - so your animation approach would be based more on familiar things you can do to a UIView but still not hard.

Don't forget to use that classic piece of RPG dialog, "..." - but please don't make text appear slowly, character by character, or have long un-skippable animations - going through the introduction of Final Fantasy Tactics Advance for the second time nearly killed me.

Adam Eberbach
I found this bit of code:UITextView * tv = [[UITextView alloc] initWithFrame:CGRectMake(5, 5, 310, 100)]; self.textView = tv; [tv release]; [self.view addSubview:textView]; [textView setText:@"What the hell\nis going on?\nla\nla\nla"]; [textView scrollRangeToVisible:NSMakeRange([textView.text length]-1, 1)];However, I'm still very confused about how to get the text to magically horizontally appear like it does in every other RPG. Mind giving me a few pointers? Thanks!
What I mean is: The dialogue box would start out blank, and the text would be "revealed", like it is in most JRPGs. Can that be accomplished with a TextBox? Thanks!
Yes - set a timer to fire at the frequency you want characters to appear, on each timer event add one character to textView.text - but don't forget you can't touch UIKit in a secondary thread and don't forget to allow aborting the gradual reveal for people who have sat through it all once already.
Adam Eberbach
Do you mean I would be concatenating a string-character on each fired timer event?