In this video you will program
the android to tell a story using the different
costumes available in the starter project you chose.
Click on the costumes tab to check out
the different actions for your android.
There are multiple costumes named and
grouped by the action you will animate.
This example shows the android feeling happy,
playing basketball, and falling asleep.
You will use these three actions to create
an animated story.
First decide how your story will start.
Perhaps the android will say something
to the audience or perform some action.
To make your android greet the audience
add a one flag clicked event and a say block
then type an opening message.
In the example story, the android will say Hi.
Next code the first animated action.
An action is made up of several costume changes
that are slightly different from each other.
When the costume changes quickly,
it creates the illusion of movement.
The costumes have numbers at the end of their names
showing the order in which they should switch.
In this example starter project,
the android has 10 costumes that create
the happy actions,
eight costumes that create the basketball actions,
and nine costumes that create the falling asleep action.
The starter project you chose
might have different actions
but the concept will be the same.
To code the first animation for your android
drag out a switch costume block.
Choose a costume that has a one at the end of the name.
This example starts with the happy1 costume.
Great!
Next, add a repeat loop,
a next costume block,
and a wait block.
Tinker with the value inside the wait block
so the costumes switch quickly
and there are no long pauses between
each frame of the animation.
This example uses point two.
Drag this code stack under the first say block.
Test your code.
When the flag is clicked,
the android says Hi
and goes through the happy animation.
Hey, looks like there's a bug.
The android goes to the next animation
with the basketball.
To fix this, look at the costumes
in the switch costume block.
There are 10 happy costumes.
The switch costume block starts on costume one.
The sprite needs to change costumes
nine times to end on costume 10.
Change the number in the repeat loop
the total number of costumes minus one.
Test it and make sure that only one
action animates.
Add more say blocks to continue developing
your story.
Now it's your turn.
Add at least one say block
to make the android say something to the audience.
Then code your first animated action
using the switch costume block,
repeat loop, next costume block,
and the wait block.
Remember, your repeat loop may contain a different number
than the one shown in this example.