5. Tell a Story
Now that you have an animated setting for a story, you’ll add two characters and sequence dialogue between them.
To start though, select a boat for your story.
Click the “boat” sprite, and click the costumes tab.
There are four costumes here that you can choose from.
Click one to select it.
Next, choose two characters to put on this boat.
Click, “choose sprite from library,” and select your first character.
These characters will be on a boat together, so think about what kind of story you want to tell.
What two characters would be interesting to put on a boat together?
Maybe they’re two characters who don’t get along, or who might not agree on where they’re going.
Maybe they ended up on the boat by accident?
This example chooses a penguin for the first character.
Once you have one character, add another.
This example uses a dinosaur, but you will use the characters you choose.
To flip a sprite so that the two sprites are facing each other, click the costumes tab and the “flip left right” button.
Click and drag the characters around the stage to move them.
The characters will be in front of the boat when you do this.
To fix this, program the boat and the water to go to the front of the stage.
Click the boat.
This sprite is already programmed to go to the front, then go back 1 layer.
Click the water sprite, and add a “go to front” block from the looks menu under the “When flag clicked.”
Click the flag to test it out.
Great, your two sprites look like they’re in the boat.
Select one sprite to start your dialogue.
Then, from the looks menu, drag out a “say” block.
Click to run this. The first sprite should say, “Hello!”
Change the value of this block to the first line of dialogue in your story.
How will this character start your story?
Consider why these characters are on a boat together.
Are they stuck?
Going on a cruise?
Looking for treasure?
Think about the story you want to tell before you start to write dialogue.
This example says, “I think we’re lost!”
Next, select the other character sprite.
Drag out a “say” block, and write the next piece of dialogue.
How does this sprite respond to what the other character said?
This example sprite says, “What makes you say that?
but your project should tell your story.
To run these blocks, you have to click them.
Remember from earlier, though, that you can make code run when the flag is clicked.
Add a “when flag clicked” event to each “say” block.
Click the flag to test this.
There’s the wave animation, and both sprites start talking.
They talk at the same time, though.
Two characters talking at the same time is hard to follow.
To fix this, add a “wait” block before the “when flag clicked” block for the second character who talks.
Each character talks for 2 seconds now, so change the value of this block to 2 seconds.
Click the flag to test.
Awesome, one sprite talks, and the second one responds.
Continue the characters’ conversation using “say” and “wait” blocks.
Click back on the first sprite that talks, add a “wait” block, and change the value to 2 seconds.
Then, add another “say” block.
While you sequence dialogue between the two sprites, test often so you catch mistakes as they happen.
If two sprites talk at the same time, read your code in the order that it runs to help find the “bug” or unexpected behavior.
Continue to build as complex of a story as you’d like.
After you’ve told a story, move on to the next page to learn about more ways to add code to this project using the add-ons.
Now, it’s your turn: Add two sprites. Add a "go to front" block to the water sprite.
Add “when flag clicked” and “say” blocks to the first sprite to make it talk.
Add “when flag clicked,” “wait,” and “say” blocks to the second sprite to make it talk.
Continue to build your dialogue until you’ve made a story!