Skip to content

Please update your browser

Your browser version is not supported by this site. CS First may not work properly. Learn more

2. Tell the Story

Transcript

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 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 “when 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” action, 8 costumes that create the “basketball” action, and 9 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 1 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 0.2.

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 1.

The sprite needs to change costumes 9 times to end on costume 10.

Change the number in the repeat loop to the total number of costumes minus 1.

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.

arrow_backward Back
Next arrow_forward
Instructions
  1. Make the android say something to the audience.
  2. Code an animated action.