I pretty much had all the basic knowledge needed to write it without problems, thanks to the previous lectures, but still i struggled, not because of lack of knowledge, but because when i come in front of wall of code i get overwhelmed and i stop thinking. What i did was, i checked the old functions we did in previous lectures and it hit me. Why don’t i make a new method and call it via the OnUserInput method from before, and so i did. IF anyone is interested, here is the method:
void Checkingpass(string input)
{
if (input == "password1" && level == 1)
{
Terminal.WriteLine("congrats");
currentScreen = Screen.Win;
}
else if (input == "password2" && level == 2)
{
Terminal.WriteLine("congrats");
currentScreen = Screen.Win;
}
else {
Terminal.WriteLine("Wrong password");
}
}
Also in the OnuserInput method i added:
else if (currentScreen == Screen.WaitingForPassword) {
Checkingpass(input);
}