My Solution

I’m experienced with C# already so my solution deviated a little bit from what has been taught so far in the content of the course.

I created the member variable “string password” but I also created a new method called SetPassword() which is called within StartGame().

SetPassword() uses a switch to check the value of “level” and assign the appropriate string value to the “password” member variable.

I also added another else-if block to the “OnUserInput” that checks if the currentScreen == Screen.Password.

If it does, it calls CheckPassword(input) which uses an if-else statement to determine if the input matched the password or not and gives the proper output to the user (similar to what was shown in the lesson). :slight_smile: Working out pretty good so far!

1 Like

Privacy & Terms