It worked (mostly) but was a mess

I did it the hard way and split the enum “password” into two enums: password1 and password2.
I then created nested if statements for password1 and password2 within two separate functions: StartGame1 and Startgame2 respectively (updating OnUserInput to allow input in these functions). As I did not crate a member variable, I created individual if statements for the correct password: if (input == “spoon”) then… for both password1 and password2.
It worked and behaved like it should have when the game ran, but it was really messy, and there was a persistent problem where the password would automatically receive an input (in the password screen) before the user even put anything in, making “incorrect password” come up when you first select a level, but then it worked fine. In the end I followed Ben’s method and realized how messy and unnecessary mine was. This was a great exercise and I look forward to the next challenge.

It sounds like it was a good learning experience though! My toughest challenge was understating that onUserInput could not be “called” again, and that I had to instead redefine the screen and handle the input differently from there.

Privacy & Terms