In this add-on,
you will create an alternate ending to your storyboard
based on user input.
To do this, you will create a decision point in your story
and create a new scene.
In an interactive story or game,
a decision point let's the user decide
what action the character will take next.
Such as whether it will turn right or left,
swim the moat or climb the castle wall
or fight an enemy or retreat.
First, choose the spot in your story
where the decision point will be,
then select the sprite there.
This example uses the third scene
so that the user's decision will decide the story's end.
Next, decide what the decision point will be.
Will the sprite choose which way to move
such as right or left?
Or will the sprite perform one action or another?
Then, ask the user to choose at any point in your scene.
Add an ask block to present the choice.
Detach the code below it.
Add an If-Else block under the Ask block.
Drag out an Equals block and add it to the If-Else block.
Add the answer variable
in the first value of the Equals block.
In the other value, type in the decision.
Place the code you detached
in the first part of the If-Else statement, test it out.
The story plays and the user answers a question.
Type in your response in the original ending place,
Next, provide an alternate ending.
In this example, the backdrop of scene four changes
depending on the user's decision.
To make a new scene, click on the Stage,
then the Backdrop tab.
Right click the backdrop you are using and select Duplicate.
Click on Add and find a backdrop you like.
Click the new backdrop.
Edit the new backdrop to include a different scene.
The backdrop is much too big, drag the corner
to make it slightly larger than a fourth of the stage.
Then, position the backdrop
so that it doesn't overlap with the other scenes.
Zoom into the center to make the adjustment precise, nice.
Next, program the Else portion to make an alternate ending.
Based on the user's decision,
come up with another storyline.
Place the blocks you use in the Else portion.
Once scene three ends, add a Broadcast block
and create a new message.
Name it Alternate Ending.
Select your fourth scene sprite.
Drag out a When I Receive block
and select Alternate Ending form the drop-down.
From the Looks menu, add a Switch Backdrop block
and change the drop-down to the new backdrop.
At this point, add blocks to finish the story.
Use the characters that you have
or make new ones to complete the story.
When you finish, a decision point
will change the backdrop and the story
based on the user's answer to a question.
Now, it's your turn, program a decision point
using Ask, Answer, Equals and If-Else blocks.
Create a new backdrop.
Program an alternate ending
using Broadcast and Switch Backdrop blocks.
Sign in to track your progress and earn badges