My Level 4 Ascii Art

I got lazy so I copied the cat ascii art from this website: https://www.asciiart.eu/animals/cats

For some reason when I tried adding the menuHint constant underneath the ascii art it would add an extra space which made my ascii art not fit in the screen. But when I did it the Terminal.Writeline way it didn’t add a space. I don’t know why this is. I’ve been having a few strange problems with the spacing tho.
If anyone knows why this is then please tell me. I might be doing something stupid:sweat_smile:.
Here’s my code:

 //Game state: availble everywhere
    int level;
    string password;
    const string menuHint = "Type 'menu' to return to the Main Menu."; // this varible remains constant so it stays the same throughout the game.
   //TODO- make hint function that shows the definition of the word when the user type 'hint'
    enum Screen { MainMenu, Password, Win, EasterEggs };
    Screen currentscreen;

    // Stores data. Start counting from 0
    string[] level1Passwords = { "rain",  "bow", "dog", "mommy", "daddy", "book", "duck", "sister" };
    string[] level2Passwords = {"multiply", "divide", "osmosis", "enzyme", "geometry", "mitosis"};
    string[] level3Passwords = { "nihilism", "anathema", "assonance", "existential", "incognito", "plagiarism" };
    string[] level4Passwords = { "beguile", "conflagration", "assiduous", "alacrity", "exigent", "potentate" };
     
// Use this for initialization
void Start()
    {
        string username = "Hello " + System.Environment.UserName + "!" + " Thank you for your purchased of Hacker McHack 9000."; //2) Define the varible further if needed.
        ShowMainMenu(username); //3)Call the Function
    }

    void ShowMainMenu(string username) //1) Declare that the function exist. Declare the that varible exist.
    {
        Terminal.ClearScreen();
        currentscreen = Screen.MainMenu;
       
        Terminal.WriteLine(username);// 1.1) Tell the function how to use the varible.
        Terminal.WriteLine("Here you can hack into anyone's mind");
        Terminal.WriteLine("and control them remotely from home!");
        Terminal.WriteLine("");
        Terminal.WriteLine("Who would you like to hack into today?");
        Terminal.WriteLine("Press 1 for Baby");
        Terminal.WriteLine("Press 2 for Teenager");
        Terminal.WriteLine("Press 3 for Adult");
        Terminal.WriteLine("Press 4 for Cat");
        Terminal.WriteLine("Enter your choice: ");
        
    }

    //Should decide how to handel the input, not actually do it
    void OnUserInput(string input)
    {
        if (input.ToUpper() == "MENU")
        {
            ShowMainMenu("Welcome back to the main menu " + System.Environment.UserName);
        }

        else if (currentscreen == Screen.MainMenu)
        {
            RunMainMenu(input); //passes input to the MainMenu state 
        }

        else if (currentscreen == Screen.Password)
        {
            RunPassword(input); //Passes on input to the RunPassword function where the passwords will be processed.  

            
        }
    }

    void RunMainMenu(string input)
    {
        bool isValidLevel = (input == "1" || input == "2" || input == "3" || input == "4");
        if (isValidLevel)
        {
            level = int.Parse(input); // Convert the string "1" ,etc, to intergers. Don't have to write "1" all the time now
            AskForPassword();
        }
        else if (input.ToUpper() == "BEEP BOOP" || input.ToUpper() == "MEOW"||input.ToUpper() =="BOO"||input.ToUpper() == "I DON'T WANT TO PLAY")
        {
            RunEasterEggs(input);
        }
        else 
        {
            Terminal.ClearScreen();
            Terminal.WriteLine("Please select an actual level ಠ_ಠ");
            Terminal.WriteLine(menuHint);
        }
        
        
    }

    void RunEasterEggs(string input)
    {
        currentscreen = Screen.EasterEggs;

        switch (input.ToUpper())
        {
            case "BEEP BOOP":
                Terminal.ClearScreen();
                Terminal.WriteLine("Beep Beep Boop Bop Boop Beep Beep");
                Terminal.WriteLine("(ノ°ο°)ノ");
                break;
            case "I DON'T WANT TO PLAY":
                Terminal.ClearScreen();
                Terminal.WriteLine("Okay so...");
                break;
            case "BOO":
                Terminal.ClearScreen();
                Terminal.WriteLine("⊂(•̀_•́⊂ )∘˚˳°");
                break;
            case "MEOW":
                Terminal.ClearScreen();
                Terminal.WriteLine("(^=˃ᆺ˂)");
                break;
        }
        Terminal.WriteLine(menuHint);
    }
      
    void AskForPassword()
    {
        Terminal.ClearScreen();
        currentscreen = Screen.Password;
        SetRandomPassword();
        Terminal.WriteLine("Unscramble this!: " + password.Anagram());
        Terminal.WriteLine(menuHint);
        if (level == 4)
        {
            Terminal.WriteLine("P.S. Type 'hint' to get a definition of the word!");
        }
    }

    void SetRandomPassword() // ToDO- make pictures for the password screen?
    {
        switch (level)
        {
            case 1:
                password = level1Passwords[Random.Range(0, level1Passwords.Length)];
                break;
            case 2:
                password = level2Passwords[Random.Range(0, level2Passwords.Length)];
                break;
            case 3:
                password = level3Passwords[Random.Range(0, level3Passwords.Length)];
                break;
            case 4:
                password = level4Passwords[Random.Range(0, level4Passwords.Length)];
                break;
            default:
                Debug.LogError("Invalid level number.");
                break;
        }
    }

    void RunPassword(string input)
    {
        if (input.ToLower() == password)
        {
            ShowWinScreen();
        }
       else if (input.ToUpper() == "HINT")
        {
            RunLevel4Hint();
        }
        else
        {
            AskForPassword();
        }
    }

    void ShowWinScreen()
    {
        Terminal.ClearScreen();
        currentscreen = Screen.Win;
        ShowLevelReward();
    }

    void RunLevel4Hint()
    {
        switch (password)
        {
            case "beguile":
                Terminal.WriteLine("To persuade or trick someone into doing something, especially by saying nice things to them"); //The spacing here is very odd
                break;
            case "conflagration":
                Terminal.WriteLine("A very large fire that causes a lot of damage");
                break;
            case "assiduous":
                Terminal.WriteLine("Hard-working and thorough");
                break;
            case "alacrity":
                Terminal.WriteLine("Quickly and with enthusiasm");
                break;
            case "exigent":
                Terminal.WriteLine("Requiring immediate aid or action");
                break;
            case "potentate":
                Terminal.WriteLine("One who wields great power or sway");
                break;
            default:
                AskForPassword();
                break;
        }
    }

     void ShowLevelReward()
    {
        switch (level)
        {
            case 1:
                Terminal.WriteLine(@"
    ____  BABY HACKED!
   {  .|      ______
 |  \__v     ||     |........
 |  (/)      ||     |       : 
 |  /  \____ ||_____|     _ +++_
 | ((___   ===='===='=    +(0_o)+
 |-------|  ||    ||      /|```|\
     |   |_ ||    ||       \___/
    ===            
                                 ");
                //ToDO-delay the clearscreen action and add animation
                Terminal.WriteLine("Type 'menu' to return to the Main Menu");
                break;
            case 2:
                Terminal.WriteLine(@"
    ____  TEENAGER HACKED!!
   {  .|      ______      + / /\_\+
 |  \__v     ||     |......+\/-_/+
 |  (/)      ||     |          |
 |  /  \____ ||_____|         /|\
 | ((___   ===='===='=        ( )) 
 |-------|  ||    ||           ||
     |   |_ ||    ||           ||
    ===                       _||
                                ");
                Terminal.WriteLine("Type 'menu' to return to the Main Menu");
                break;
            case 3:                 //TODO- Add loading screen?
                Terminal.WriteLine(@"
    ____   ADULT HACKED!!!
   {  .|      ______     ..:__/ \__
 |  \__v     ||     |...:  |\ \/  /\
 |  (/)      ||     |      ||____| | 
 |  /  \____ ||_____|       | -  |/
 | ((___   ===='===='=      | |  |
 |-------|  ||    ||        | |  |
     |   |_ ||    ||        | |  |
    ===                   __|  __|
                                   ");
                Terminal.WriteLine("Type 'menu' to return to the Main Menu");
                break;
            case 4:
                Terminal.WriteLine(@"
    ____   CAT HACKED!!!!
   {  .|      ______     
 |  \__v     ||     |    -++++-
 |  (/)      ||     |....+/\ /\+
 |  /  \____ ||_____|    ( o 0 )  (
 | ((___   ===='===='=     \ /    )
 |-------|  ||    ||     ( | | ) (
     |   |_ ||    ||    (__d b__)                                      
    ===                             ");
                Terminal.WriteLine("Type 'menu' to return to the Main Menu");
                break;
            default:
                Debug.LogError("Invalid reward");
                break;
        }
    }
} 
1 Like

Privacy & Terms