arrow_back Add Your Friend
In this add-on, you’ll add your friend to your story, and create a dialogue with them.
To start, add an android sprite to represent your friend.
Right click the android sprite, and select duplicate.
Click and drag the sprites to reposition them on the stage.
Next, click the new friend sprite to select it and delete the copied code by dragging it back into the blocks palette.
Choose a new costume to represent your friend by clicking the costumes tab and selecting an option.
Next, program the friend sprite to join the conversation by responding to the first thing your sprite says, which in this example is “My friend and I have 5 things in common…” Select events, and drag out a “when flag clicked” block.
To respond to the sprite, select looks, and drag out a “say for 2 seconds” block.
Add a response to this block.
This example will say, “Let’s share them!”
Then, click the flag to test.
Great the friend sprite talks, but both sprites talk at the same time.
To fix this, program each sprite to wait while the other talks.
For the friend sprite, click control, and add a “wait” block before the “say for 2 seconds” block.
Change the value to 2 seconds.
Click the flag to test!
Ok, great, the friend waited, but now the sprite that represents you needs to wait for the friend to talk.
Select the sprite that represents you and add a wait block after the first “say for 2 seconds” block and change the value to 2 seconds.
Click the flag to test.
Awesome, now the two sprites don’t talk over each other.
Look at these block stacks side by side.
When you click the flag, the sprite that represents you talks, and the friend waits.
Then the friend talks, and your sprite waits.
Continue adding “say” and “wait” blocks to sequence conservation between you and your friend!
Now it’s your turn: Duplicate the android sprite, and select a new costume for your friend.
Sequence conservation between the two sprites using “when flag clicked,” “say,” and “wait” blocks.