Skip to content

Please update your browser

Your browser version is not supported by this site. CS First may not work properly. Learn more.

Transcript

The Two Truths & A Lie game only reacts if your friend chooses the correct answer.

To make the game more fun, make the sprite say something even when users do not choose the right answer on the first try.

From the looks menu, add a say block into the else section of the conditional.

Make this one say something like, "No, that one was true!"

Code in the else section of the conditional block will only run when the condition is false.

Click on the block stack to test it out.

Don't forget to try entering different values in the ask text box.

To test the else section of the code type a letter that matches one of the truths.

This example uses A.

The sprite says, "No, that was true."

Finish your product by adding a when flag flagged block to the beginning to make it easy for anyone to run your code by clicking the green flag.

Now your program is complete.

When the green flag is clicked, the sprite says two truths and a lie.

Then it asks the user which is the lie?

A, B, or C?

When the user responds, the programs checks if the answer is the lie.

If the answer is the lie, the sprite says, "You win."

Else, if the answer is a truth, the sprite says, "No, that one was true."

Also change the costume to be whichever sprite you want.

Click on the costumes and select a costume that interests you.

To make the project your own, give the project a creative title and add instructions for others who will view your creation.

Now it's your turn.

Program a losing condition in the else section of the if, then block.

And a when flagged clicked event to the beginning of the program.

Test your code.

Add a title and instructions to the project page.

Instructions
  1. Program a losing condition in the else section of the "if-else" block.
  2. Add a "when flag clicked" block to the beginning of the program.
  3. Test your code.
  4. Add a title and instructions to your project page.