In this video,you will create different animations for your monsterby making it change costumes multiple times.
Select the Costumes tab.
You will see several costumesthat reflect different emotions.
First, program the sprite to show a happy emotion.
To do this, change costumes quicklyto express the monster's happy animation.
Snap together three switch costume blocks.
Change the drop-downs to happy1, happy2, and happy3.
Add wait blocks after the costume changesso that the program waits to run each block.
That way, you can see the animation.
Next, code the animation to happen continuously.
Add a repeat loop around the switch costume blocks.
Test it out.
Next, program a sad emotion.
One way to do that would beto copy the entire block stack you just made,but that would be very repetitive.
In computer science, you can use a different approachto create the same functionality with less code.
Whether the monster is changingto different happy or sad costumes,it uses switch costume blocks.
Make the monster switch costumeswithout repeating all of those blocks.
Use a variable to set the feeling,and tell the code to determine which costume to usebased on that variable.
Recall that a variable stores informationor values that change, so the program can use it.
This example will use a variable for the feelingsso that when the happy, sad or angry feeling is set,the variable determines which costumes to use.
Make a variable,and name it something that makes sense, like feeling.
Place the set feeling block above the repeat loop.
Type sad into the space in the block.
Note that the costume names in the sad animationcontain the word sad and also a numberthat represents the order it appears.
Your variable contains sad but it needs the numberto complete the costume name.
From the Operators menu, drag out a join blockand place it inside the switch costume block,then place the feeling variableinto the first value of the join blockand type the number one in the second value.
The block can be read as switch costume to sad1.
Click the block to test it.
The monster changes its expression to the sad1 costume,then changes to happy2 and happy3.
Change the value of the variable to happyand click the block.
The monster changes to the happy1 costume.
Duplicate the join block and change the costume numbers,creating a costume change for numbers two and three.
Add a when flag clicked block,then test this by clicking the flag.
The happy expression animates.
If you type sad inside the set feeling block,the sad expression animates.
Lastly, to make the expression continuously animateuntil you change the emotion,replace the repeat loop with a forever loop.
That way, your animation doesn't havea definite stopping point.
Feel free to tinker with the values in the wait blocksto make the costumes change quicker or slower.
This example uses a value of .2 in each wait block.
In the next video, you will program the monsterto say a message and express an emotion that goes with it.
Now it's your turn.
Create a feeling variable.
Then code your monster to animate different expressionsusing the feeling variable, switch costume,wait, join, and forever blocks.
Set the starting emotion with the set feeling blockand a when flag clicked event.
Create a "feeling" variable.
Program the monster to animate different expresions.
Set the starting emotion.
Sign in to save your project and track your progress.