Scratch exercise tutorial 139

Step drawing

In this tutorial you will learn how to combine scripting steps together to draw letters and shapes, and to write your name.

 

Complete these steps ..

 

1. Open Scratch, OR create a new game (from the top menu choose "File>New").

 

 

2. Select the cat sprite under the stage, and then right-click to delete it.

 

 

3. We need to paint the stage black. Select the stage and switch to the Backgrounds tab ..

 

Click on the "Edit" button and then use the paint bucket tool to fill your stage with black ..

Click "OK" when you are done.

 

 

4. Now, we need to create a pen nib sprite which we will use to draw our shapes.

Click the "paint new sprite" button under the stage ..

 

Select the paint brush tool and then choose it's smallest size ..

 

Click once in the middle of the paint window to paint a single tiny black dot ..

Click "OK" when you are done.

 

 

5. Re-name your new sprite "Nib" ..

 

 

6. Use File>Save as to name and save your game. Name it "Step-drawing" ..

 

 

7. Let's add our first script to the Nib sprite. Add this script ..

This script will set the initial (start) values of our sprite, ready to draw. You can experiment with different values for the pen colour later on.

 

 

8. Let's add a script that will allow us to clear (erase) the drawing when we press the "C" key on our keyboard ..

 

 

9. Add a script to draw a line ..

 

 

10. Now add a script to move the nib without drawing ..

 

 

11. Let's combine this scripts to create a drawing whenever we press the space-bar on the keyboard.

Add this script and then press the space-bar to try it out ..

Note how we have added "point in direction" script blocks between the broadcast script blocks to control the direction of the drawing.

 

 

12. Use "File>Save as" to re-save your game ..

 

 

13. Let's create some more scripts. Add this to draw a diagonal line ..

 

Now edit the existing "when space key pressed" script to create this..

Note how we are using "point in direction 150" to draw a downward diagonal line, and "point in direction 30" to draw an upwards one.

 

 

14. We can also create shapes. Add these scripts ..

 

 

15. Now edit the existing "when space key pressed" script to create this (it will write the word "MOON") ..

 

 

16. When you have finished, use "File>Save" to re-save your game ..

 

 

17. Well done, you've finished this exercise. Now, create a script to write your name!