What do you print when the player wins/loses Triple X?

10_tx_uc2
#1

In this lesson we learn how to work with if else statements in C++.

What messages do you print to the player when they win and lose the game?

#2

Overall Win message:

“You can finally give yourself a well deserved pat on the back after defeating all the locks to uncover the largest hoard of valuable minerals you’ve ever seen.”

Level Win Message:

“You can breathe again now that you’ve managed to get through the lock on the outer airlock door. Now onto the inner airlock door which will be harder to crack, but you can do it!”

I’m implementing code to have the names of the doors change as you move through the levels.

Lose Message:

" Damn, you’ve guessed the wrong code and now you’ve lit up 1 of the anti-hack indicators. If you get it wrong 2 more times you’ll be locked out forever."

I’m also looking to implement code that will allow me to record the number of guesses and end the game if they don’t get it right within 3 tries.

1 Like
#3

Great idea! I like how the lectures are keeping everything basic but give you enough knowledge to maybe implement some of your own tweaks with a little research.

I went with a bank robbery theme so my win/lose outputs:

    // Evaluate guesses and return win/lose
	if (GuessSum == CodeSum && GuessProduct == CodeProduct)
	{
		std::cout << "The vault opens!  You make off with 100 million dollars!" << std::endl;
	}
	else
	{
		std::cout << "The code is incorrect.  The doors lock and the police have been notified." << std::endl;
	}
2 Likes
#4

I like your messages.

When I’ve got my code finished today I’ll post it on here for others to see how I did things.

#5

I followed my story of a thief trying to lockpick a chest in a noble’s mansion :

    if(GuessSum == CodeSum && GuessProduct == CodeProduct)
    {
        std::cout << "Success! The chest opens and you fill your bag with everything that seems to be valuable." << std::endl;
        std::cout << "When you finally get out of the mansion, you notice something is moving from inside your bag!" << std::endl << std::endl;
        std::cout << "Perhaps your adventure is not over yet..." << std::endl;
    }
    else
    {
        std::cout << "The chests ignites and explodes at your face. You weren't fast enough to escape your fate..." << std::endl;
    }
2 Likes
#6

This are my winning and losing messages:

#7

#8

woops. *vanishes. Fixed

#9
 if (GuessSum == CodeSum && GuessProduct == CodeProduct) 
    {
        PrintNextLevel(Difficulty);  
        return true;
    }   
    else
    {
        std::cout << "Rats that's not the right code... what else might it be?\n\n";  //Add Set Number Of Tries
        return false; 
    }

I’ve gone for that so far as I wanted to have the difficulty being used in the next level text, currently working on a fail condition as well and perhaps different text for at least the last level so it can be something like “you’re almost there” instead of being so generic every time.

#10

My story is about a archaeologist:

If the player wins: “An ancient stone door slowly opens to the next room. It is so slow that it feels comical rather than climactic…”

If the player loses: You were hit in the head by a flying rock. Before you died you thought ‘Huh, I didn’t know rocks could fly…’. As your light slowly fades away to darkness a winged creature (It wasn’t an angel trust me…) appears before you. ‘Rise Discount Indiana Jones, and try again.’ "

#11

Following a more shadow run style break and enter mission:

My win lose at this stage is as follows:

    if(GuessSum == CodeSum && GuessProduct == CodeProduct)
    {
        printLine("    Access Granted");
        printLine("");
        printLine("Looking up at the cam feed you see the panel turn green and the door slides open for your team they filter into the building quietly.");
    }else
    {
        printLine("    Access Denied notifying security");
        printLine("");
        printLine("Oh ***! Looking up at the cam feed you see the panel turn red and an alarm starts to blare, your team turn and run.");
    }