We now have a good understanding of Scratch programming. Its time we move on to the Advanced level of Scratch.
In Advance Scratch, we learn more complex coding. We learn how to make our characters more interactive.
Here we see an example of how to make interactive animations.
Create a new project and put the backdrop as a forest. Next, create a sprite and its second costume.
Now we code the sprite to move on clicking it. But first, we give it a starting position when the green flag is clicked. We also make it say that it needs to be clicked to prompt the user.
We start on the actual movement part. We choose the “when this sprite clicked” block and add in our movement blocks such as “move 10 steps”, “wait .3 seconds”, “if on edge, bounce” and “next costume”. We repeat all of this 10 times.
That’s the code for one sprite. We take another sprite and code it to make the backdrop switch to the next one when the sprite is clicked.
We have another set of code for our wizard girl sprite, which will prompt the user to click on it to change the backdrop after 12 seconds once the green flag is clicked.
For the next part of this code that consists of the sprite speaking, we will have to add an extension. To do that, we click on the “Add extension” icon on the lower left corner and choose the Text to Speech extension.
Join the “speak” block in our code and put in the text as “hello”. Add in another ”speak” block with the text “click on me to change backdrop”. Lastly, use the “set voice to“ and set it to “tenor”.
Now we’re done coding our Wizard Girl. We still have multiple sprites to go.
Our next sprite will be a Ballerina and we have to make her dance. So we choose the Ballerina sprite. This sprite contains multiple different dance step costumes already.
To make her dance, we only need to keep changing her costume continuously. A fairly easy-to-understand code.
And that’s it for our Ballerina. Next sprite is a heart that changes colors when we press the space key. Here we have our Heart and its different costumes that we need to make.
So we have two sets of code for this. One for prompting the user when the green flag is clicked and the other for the actions when the space key is pressed. The prompt code looks like this.
Now for the space key code, we add a “when space key pressed” block and then join a “repeat 10” block. We put in “next costume” and “wait .3 seconds” inside the repeat block. This will repeat the action of costume changing 10 times when the space key is pressed.
That’s our entire code for Heart.
Moving on, we have our Elephant sprite with two costumes given.
We want the elephant to prompt the user to press the “a” key. We also want the elephant to blow his trumpet when the key is pressed as well as change his costume. So our code will be as shown below.
Our last sprite will be the Dorian sprite with its different given costumes.
We will make him exercise and stretch. To do so, like all the other sprites, we will have a prompt code on the green flag click and the action code on pressing any key. The prompt code goes like this.
Our action code consists of “when any key pressed”, “next costume” and “say thank you for 2 seconds” blocks.
And the coding for all our sprites is done. Now we have a very chaotic forest project!!
This project showcased a few of the ways we can animate our characters or sprites using Advanced Scratch.