Difference between revisions of "2021-In game help screen"

From TRCCompSci - AQA Computer Science
Jump to: navigation, search
(Created page with "=Issue= There is no in game help available within the game, Players will need to know all the commands available. =Solution= Create an option for 'help'. This would need to...")
 
(PlayGame)
 
Line 19: Line 19:
  
 
This for loop will allow the user to enter 3 separate commands. If one of these is 'help' we want to display the help information, but not count towards their 3 commands.
 
This for loop will allow the user to enter 3 separate commands. If one of these is 'help' we want to display the help information, but not count towards their 3 commands.
 +
 +
<syntaxhighlight lang=c#>
 +
                for (int count = 1; count <= 3; count++)
 +
                {
 +
                    string command = "";
 +
                    do
 +
                    {
 +
                        Console.Write("Enter command: ");
 +
                        command = Console.ReadLine().ToLower();
 +
                    }
 +
                    while (command == "help");
 +
                    commands.Add(command);
 +
                }
 +
</syntaxhighlight>

Latest revision as of 12:24, 11 September 2020

Issue

There is no in game help available within the game, Players will need to know all the commands available.

Solution

Create an option for 'help'. This would need to be implement so it doesn't take one of the three commands of the player.

PlayGame

Within the PlayGame method, find the following for loop:

                for (int count = 1; count <= 3; count++)
                {
                    Console.Write("Enter command: ");
                    commands.Add(Console.ReadLine().ToLower());
                }

This for loop will allow the user to enter 3 separate commands. If one of these is 'help' we want to display the help information, but not count towards their 3 commands.

                for (int count = 1; count <= 3; count++)
                {
                    string command = "";
                    do
                    {
                        Console.Write("Enter command: ");
                        command = Console.ReadLine().ToLower();
                    }
                    while (command == "help");
                    commands.Add(command);
                }