Hi All,
Got stuck with an issue, and would appreciate any help that can be provided. Basically, I am trying to make the game more legible by adding detail about what the user is doing. Everything works, but for some reason, the else statement for CheckPassword() fires even before the user has a chance to enter an input. My code is below:
void StartGame()
{
Terminal.ClearScreen();
InformationChoice();
}
private void InformationChoice()
{
if (level == 1)
{
CurrentScreen = Screen.Password;
Terminal.WriteLine("You have selected Level " + level);
Terminal.WriteLine("Breaking into " + LocalElementarySchool);
Terminal.WriteLine("Enter Password:");
}
else if (level == 2)
{
CurrentScreen = Screen.Password;
Terminal.WriteLine("You have selected Level " + level);
Terminal.WriteLine("Breaking into " + YourCityHall);
Terminal.WriteLine("Enter Password:");
}
else if (level == 3)
{
CurrentScreen = Screen.Password;
Terminal.WriteLine("You have selected Level " + level);
Terminal.WriteLine("Breaking into " + TheFederalReserve);
Terminal.WriteLine("Enter Password:");
}
else
{
Terminal.WriteLine("Not a valid choice");
}
}
void CheckPassword(string input)
{
if (input == password)
{
Terminal.WriteLine("Congratulations!");
}
else
{
Terminal.WriteLine("Try again.");
}
}
Where am I going wrong that is causing the Try again comment to come up before the user has a chance to guess?
Thanks for any help!