Please update your browser
Your browser version is not supported by this site. CS First may not work properly.
In this video, you will learn how to make the sprite ask the user a question.
To start the Two Truths and a Lie game, the sprite needs to say 3 different things - two
truths and one lie.
Click on the Android sprite.
Then, click on the “looks” menu.
Drag a “say” block to the scripts editor.
Type the letter A and a statement about yourself that is either a truth or a lie.
In this example, the sprite says one true statement.
Test the block by clicking on it.
Drag out a second “say” block, and snap it under the first.
You just built a block stack!
Type the letter B, then enter a truth or a lie about yourself in this second block.
Remember, use two truths and one lie in this project.
This example uses a truth in the second block.
Test the whole stack by clicking on it.
When you click on a block stack like this, it is called “running” the code.
The sprite says both items!
Drag a third “say” block to the scripts editor,
and snap it at the bottom of the block stack.
Write the letter C and your final item in this block.
In the example, the third block has the lie!
For the lie, try to think of something that even your friend might not know about you.
Click on the block stack to test it.
The code runs in the order of the stack, top to bottom.
The sprite tells the first truth, then the second truth, then the lie!
Next, ask the user which item they think is the lie.
Select an “ask” block from the Sensing menu, and drag it to the scripts editor.
Change the text in the ask block to ask something like “Which do you think is the lie?
Type A, B, or C.” Click the “ask” block to test it and see
how it works.
Computer scientists like you explore and test new code all the time to find out how it works.
The “ask” block makes the sprite say the question, then shows a text bar where the
user can type a response.
The “ask” block makes the sprite wait until the user responds before running any
Snap the “ask” block to the bottom of the block stack.
Now it’s your turn: Use 3 “say” blocks to make the sprite
tell 2 truths and 1 lie about you.
Use the “ask” block to make the sprite ask the user which statement is the lie.