jeudi 21 décembre 2017

Changing a user input

I am writing some code for a game and following some online class instructions, which the video instructor told me to branch off and explore my on my own to make it more unique. I am trying to figure out how I can make my code on level select say "You have picked Zoo Database." instead of having it say "You have picked 1 Database."

 `void Start(){

    ShowMainMenu();
}

void ShowMainMenu(){

    Terminal.ClearScreen();
    Terminal.WriteLine("What would you like to hack into?");
    Terminal.WriteLine("Press 1 for Zoo Database");
    Terminal.WriteLine("Press 2 for UN Database");
    Terminal.WriteLine("Press 3 for Microsoft Database");
    Terminal.WriteLine("Make your selection:");
}

int level;
 void OnUserInput(string input)
   {
    if (input == "menu"){
        ShowMainMenu();
    }
    else if (input == "1"){
        level = 1;
        StartGame();
    }
    else if (input == "2"){
        level = 2;
        StartGame();
    }
    else if (input == "3"){
        level = 3;
        StartGame();
    }
    else{
        Terminal.WriteLine("Please choose a vaild Database.");
    }
    }

 void StartGame()
    {
    Terminal.WriteLine("You have chosen the" + level "database");
    }`

This is what I have currently for my level selection. Thanks for the help!

Aucun commentaire:

Enregistrer un commentaire