Game Development Reference
In-Depth Information
Creating the High Score Entry System
The HighScoreEntryMenu class controls the menu for entering a player's high score.
The EntryMenuStates enumeration holds the type of menu button that is clicked (see Listing 9-24),
which include
None : There is no button clicked.
NextCharacterPressed : The next character button is pressed to change the
character in the selection to the next character in the character set for
user selection.
PreviousCharacterPressed : The previous character button is pressed to change
the character in the selection to the previous character in the character set for
user selection.
Enter : The current character that is displayed is entered as the character for
this position.
Listing 9-24. The High Score Entry Menu Buttons
enum EntryMenuStates
{
None,
NextCharacterPressed,
PreviousCharacterPressed,
Enter
}
The MAX_ENTRY_CHARACTERS variables hold the maximum number of characters to enter for a player's
name or initials.
private int MAX_ENTRY_CHARACTERS = 3;
The m_EntryIndex variable holds the current character position in the player's name/initial selection
input. For example, 0 would indicate that the player is selecting the first initial to enter.
private int m_EntryIndex = 0;
The m_Entry variable holds the player's name/initials.
private char[] m_Entry = new char[MAX_ENTRY_CHARACTERS];
The m_NextCharacterButton button cycles forward through the character set that is available for
entering the player's name/initials.
private MenuItem m_NextCharacterButton;
 
Search WWH ::




Custom Search