Skip to main content

Franky can blink!


Last time we drew Franky in Scratch. We learned to use different shapes and manipulate their form. Today we'll go a step further and try to breathe more life into our buddy. 
What if we gave him the opportunity to wink at someone? 


Looks good? Let's get started!

Our first step is to create a copy of the existing Franky's costume. Right click on the franky-mouse costume and choose duplicate. Same copy will be created. We need to change its name to franky-mouse-blink.

Now it's time for a secret. To simulate the blink of an eye. We need to change the shape of the eyes in our new costume. Thanks to this, we will be able to programmatically switch the costume from non-blinking to blinking once we reach the coding part.
Let's select Franky's eye and resize it vertically to make it appear that the eye is closed. We repeat the same operation for the other eye.


We finally got to the coding part. Coding in Scratch is similar to Lego blocks, where you take different plastic parts and combine them to create a new shape. We have the same story here. We need to go to the Code section from the left menu and drag and drop subsequent blocks into the coding section.

Once we have all the parts moved, we can start reading how our program will behave. In our scenario:
1. When the user clicks the green flag
2. I want to change my costume to franky-mouse (non-blinking)
3. Then in a forever loop (the blocks inside the forever block run all the time while the program is executing)
4. I want to wait 1 second on the first costume and switch to franky-mouse-blink. Then after 0.1 seconds I want to go back to the default, non-blinking costume
6. We repeat everything from step 4 again.

We have everything ready to test if Franky is alive. Let’s click the green flag and... Ta-da! Preety cool stuff right?


Thanks for reading!

Comments