skip to content
Introduction to Coding

Activity

In the previous lesson, Arun and Raj discussed Motion blocks. Now they will explore Looks blocks by using those blocks in their project.

Arun: Hello Raj! I hope you remember what we discussed about Motion blocks.

Raj: Yes Arun! Now on what topic are we having the discussion?

Arun: Today I will tell you about Looks blocks.

Let’s start with the [Say ()] block. Now open the starfish sprite and drag this block and click on it.

Raj: Starfish saying Hello! That means we can make them talk to each other.

Arun: Correct Raj! You can also use another block which will say Hello! for the given time and then disappears. It’s the [Say () for () seconds] block.

Raj: Okay!

Arun: Now make our fish reply by using the [Say ()] and [Say () for () seconds] blocks. Go to the Fish sprite, drag the blocks over there, and click on them.

Raj: Fish is replying back to the starfish. But I want that fish to turn to starfish after replying. What can I do to make that happen?

Arun: Remember the previous lesson? With the help of motion blocks, you can do that.

Raj: How?

Arun: Let me show you! Go to the Motion menu and drag out the [Point towards ()] block and select starfish from the dropdown list. Also, place it under the [Say () for () seconds] block. Click on the script.

Raj: Wow! Fish turns towards the Starfish after replying. It seems like they both are talking to each other.

Arun: We can add so many effects to our project while learning basic coding. Scratch is made for such things to be learned by us in a fun way.

Raj: Let’s move to the next block.

Arun: Why not! The next blocks are the [Hide] and [Show] blocks. Go to the starfish sprite, drag out the [Hide] block, and place it under the [Say () for () seconds] block. Click on it.

Raj: Starfish is gone. I want it back, for that I have to use the [Show] block?

Arun: Yes! Just place it under your script.

Raj: Yeah! It is back.

Raj: This is very interesting, Arun.

Arun: Yes! You know what, you can also change the expressions of the sprites.

Raj: How?

Arun: With the help of the [Switch costume to ()] block.

Raj: I want that in our story when Fish turns towards starfish, the appearance of the fish changes to some other fish. Is that possible?

Arun: Yes, it is possible! Go to the fish sprite and drag the [Switch costume to ()] block, select any costume from the dropdown list and place it under the previous code. Click on the script.

Raj: Amazing! I also want to change the expression of starfish.

Arun: Okay! Go to the starfish sprite and drag the [Switch costume to ()] block, select any costume from the dropdown list, and place it under the code.

Raj: Very fascinating, Arun!

Arun: You can also add the [Next costume] block instead of the previous one. The only difference is that in this you will not be able to choose between the given choices of costumes.

Raj: Okay! What if I want to change the background of the story?

Arun: Firstly, you have to add another background to your project. Go to the backdrop library and select a backdrop of your choice, in our case, we can add another underwater backdrop.

Arun: To change the background we will be using the [Switch backdrop to ()] and [Next backdrop] blocks. Drag out the [Switch backdrop to ()] block, select your backdrop from the dropdown list, and place it under the code. Click on it.

Raj: Yes, it changes our background. I think [Next backdrop] will also do the same.

Arun: Right, this block switches automatically to the next backdrop of your project.

Arun: As for your story, you can change the color of the starfish when it gets scared seeing another fish.

Raj: How?

Arun: Go to the starfish sprite and drag the [Change color effect by ()] block and place it under the code. Click on it.

Raj: The color gets changed. But it changes every time I clicked the script. Why?

Arun: This is because this block changes the value according to the value you given and every time when you click on the code the value gets increased and color also changes.

Raj: What if I want a fixed color for my sprite?

Arun: Instead of using [Change color effect by ()] block, use [Set color effect to ()] block and it will change the color according to the given value.

Raj: Yes! It does the same.

Arun: If you want to clear all effects for that use [Clear graphic effects] block and place it under the code in the starfish sprite.

Raj: The color-changing effect is cleared.

Arun: Yes! To make your story more effective you can also change the size of your sprite.

Raj: How?

Arun: Go to your fish sprite and see the size is 100%.

Raj: Yes!

Arun: Now drag the [Change size by ()] block and place it under your script. Click on it.

Raj: But this is increasing the size continuously whenever I click on the script.

Arun: Right! To fix the size use [Set size to ()%] block.

Raj: You are right. I changed the value to 150% and every time I click on the code, the size increased to that value only.

Arun: Good! There are some other blocks left like [Go to front layer] and [Go back () layers] blocks.

Raj: What do they do?

Arun: To understand that, just imagine that two sprites are one over the other and you want the second sprite to be above the first.

Raj: Okay.

Arun: Now use [Go to back layer] block and place it in the starfish sprite script and select “back” from the dropdown list. Click on it.

Raj: The starfish moved back to the fish.

Arun: Yes! If there are so many sprites available and to perform the same functions you can use [Go back () layers] block, select the number of layers according to your need.

Raj: I got it.

Arun: Now move to these [Show variable ()], [Hide variable ()], and [Show list ()] blocks.

Raj: How to use these blocks?

Arun: In the Looks menu, you will find out these blocks have checkboxes in front of them. Tick those checkboxes in both the sprites.

Raj: These blocks show the details of each sprite in the stage area.

Arun: Now with this, we have discussed every block of the Looks menu.

Raj: This was very interesting and I also created my own story.

Arun: Good work Raj! You can add different sounds to your story which we will learn next time.