GUI button animations running with Text Window open?

Started by Husky, Fri 07/07/2006 17:29:44

Previous topic - Next topic

Husky

Specific question: How can I keep GUI button animations running while the Text Window is open while keeping the rest of the game paused as usual?

Details: For my character's speech, I'm opening a GUI with the character's portrait on a button, then I'm opening a separate Text Window next to the portrait using DisplayAt.Ã,  While this works great with still portrait images, for animated portraits I'm having trouble keeping the portrait animated in the GUI while the Text Window is active.Ã,  The Text Window seems to pause the game (actually a good thing) but unfortunately this includes pausing the portrait animations (a bad thing.)

Here is what I have been doing:
Code: ags

gPortrait.Visible=true;Ã,  // opens portrait GUI
ButtonFace.Animate(2, 0, 4, eRepeat);Ã,  // Sets the animation for the button on the portrait
DisplayAt (72,44,236, "A few words.");Ã,  // Text appears next to the portrait.Ã,  Oh no!Ã,  The portrait animation has paused.
gPortrait.Visible=false;Ã,  //closes portrait GUI


Of note, the portrait button image is changed a lot in the game based on who is talking and what they are doing.Ã,  Sometimes it is an animation and sometimes it is still.Ã,  I'm hoping to discover a solution that is flexible enough to accommodate this.

I'd greatly appreciate anyone's thoughts.
Thank you in advance.

Ashen

First question - Why not just use 'Sierra-style speech, which does much the same thing? I'm guessing because you want more control over the look, or because it's not practical with the changing portraits you want to do - but just thought I'd mention it in case you just didn't know.

Secondly, I don't know if what you want can be done the way you're doing it because (as you've noticed) the Display... commands are blocking, which is why the animation stops. There's code around the forums somewhere for using a GUI with a Label on to simulate this, though - perhaps that'd be of use?  (Basically, you'd use Label.Text = "..." instead of the DisplayAt(...).)

EDIT:
This is the thread I meant. It's for 2.7, so you'd need to change the string stuff to use String, but that should be pretty easy, if it IS actually what you want.
I know what you're thinking ... Don't think that.

Husky

Ashen, Thank you for the reply.Ã,  Originally I was avoiding Sierra Style speech because I wanted a little bit more control.Ã,  However, after reading your post and your helpful link, I realize that there might be virtue in the simple answer.Ã,  I will therefore now use Sierra Style for simplicity.Ã,  Thanks again.

EDIT:
Just to explain why I originally wanted more control: I thought I'd put the portrait on one button, then overlay facial expression on another button (or overlapping GUI) â€" thus hopefully making the game file smaller by not needing to include graphics for all portraits with all possible expressions.Ã,  I guess I can be an optimization freak.Ã,  However, because I know so little about programming, I really don't know if these optimizations would help the file size very much anyway (the file size is already very small).Ã,  Additionally, being relatively new at programming and in the interest of not biting of more then I can chew, I'll take the simple road today (Sierra Style), but perhaps one day I'll revisit this and the suggestion by Ashen for using Label.Text to simulate a text window with a GUI â€" which is a great solution, yet I'm just a little intimated by it just now because I'm not sure how I'd tackle scaling the simulated background window to accommodate the text, alternating left and right portraits, lining up the simulated background window and text to be perfectly next to the portrait when on both left and right sides, and pausing the rest of the game during this display.Ã,  Wow â€" this is a long edit / explanation, thanks for bearing with me, anyway the point is simplicity.Ã,  Arrgh!Ã,  My perfectionist nature is tearing me up for abandoning this battle.Ã,  Focus.Ã,  Simplicity.Ã,  I will choose simplicity.

Ashen

Interesting approach. As you said though, I'm not sure how much file size you'd actually shave off.

As for the other points:
The code in the other thread doesn't actually allow for scaling the window, you're right, but you could add that with the Label.Width, Label.Height, GUI.Width and GUI.Height properties, and a fair amount of tinkering. The alternating portraits could probably be done as well (again with a fair amount of tinkering), using the Label.SetPosition and Button.SetPosition functions.
For now however, you might be right to stick with default Sierra-style. You can always go back later and add the functionality you want, when you're more comfortable with AGS coding.

QuoteWow â€" this is a long edit / explanation, thanks for bearing with me
Don't worry about it - more detail means it's more likely you'll get a useful answer.
I know what you're thinking ... Don't think that.

Husky

Yes, it'll be Sierra Style until I become more comfortable with AGS.Ã,  Thanks again Ashen.Ã,  You've been a lot of help to me not just on this thread, but because I've been learning TONS from your past posts on other topics while you were helping others.

SMF spam blocked by CleanTalk