Thank you for visiting Blazing Games

The Parts of Speech

The speech dialog display is an important part of this episode, and will be used throughout the series (though as you will see in later chapters, some changes will occur in future episodes, in fact in episode 3 there is a quick text option that is added). Knowing that this part of the game will be used in multiple episodes means that some thought to how it will be used in the future needs to be taken into account. I know that branching text is a requirement, so in addition to displaying text, the speech dialog will have to have a menu that allows the user to select a choice. I decided that three buttons should be good enough. The trick then becomes getting the text on the buttons to be dynamic.

While dynamic text in buttons should be a simple process, it wasn’t. For some reason, Flash doesn’t seem to like to let you alter the dynamic text in a button. It also had the nasty habit of making the area that the text took up not detectable by the hit area, which would mean users clicking on the text wouldn’t activate the button. My solution was to break the button up into two parts. A movie clip that contains the button’s background and dynamic text and is placed in the background. Above that is a button layer that contains the highlighting border so that the player knows he or she is about to select a button.

The text that the speech dialog contains is set up to slowly display the text to simulate someone talking. This is actually a very simple thing to do. The SlowText movie clip has all the code for handling the menus and the text. To set the text, you simply call the movie’s setMessage function which clears all the menu options and then starts to display the message by going to the ShowText frame of the clip.

The ShowText frame contains a single line of code that adjusts the dynamic text being shown.

The frame after ShowText controls the looping of the text and continually increases the amount of text that ShowText shows until the entire message is displayed, at which point it sets up the menus that the user chooses from.

The menus are defined by making calls to the setMenu function. To actually handle the button being selected, the button makes a call to a _root function called handleEvent, which is set up in the main timeline of the game. Future versions of the game take advantage of Flashes ability to pass a function reference as a parameter so the handler in future versions of the dialog box can have any function handle the menu selection.

Previous page
Chapter 2 Page 4

About - Privacy Policy - Contact - Links - FAQ
Copyright © 2006 Blazing Games Inc. All Rights Reserved