Scratch game making tutorial 136b

Drawing app - intermediate

In this tutorial you will create a simple drawing game in which the player can draw with a pencil and change its thickness and colour.

 

Complete these steps ..

 

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

 

 

2. Delete the Cat sprite by right-clicking on it's thumbnail image under the stage.

 

 

3. Download and save these two sprites ..

 

Now, use the "choose new sprite from file" button under the stage to import them ..

 

 

4. Select the "Pencil - rubber" sprite and add the first script ..

Note that the size is set to 100%. Later we will reduce this to 30% but not until we have sampled the colour of the pencil lead.

 

 

5. Now add the script to make the Pencil stay on the mouse-pointer ..

 

 

6. Now add the script to stop your game when you want to continuing making it ..

 

Press "B" on your keyboard to test your game, and move your mouse on the stage. The pencil should follow it.

Press the "E" key to end your game and continuing working on it.

 

 

7. Now add the script which lets the player draw when the mouse button is held down ..

 

Test your game again. Press the "B" key on your keyboard to begin your game, and then hold down the mouse-button and move the mouse-pointer around the stage.

Press "E" for end when you are ready to continue making your game.

 

 

8. Use "File>Save as" to save your game. Call it "Drawing app"..

 

 

9. It would be good if the player could change the Pencil line thickness (pen size). Add this script to the Pencil ..

 

Press the "B" key on your keyboard to test your game again. Hold down the Up and then the Down arrow keys to change the line thickness.

Press "E" for end when you are ready to continue making your game.

 

 

10. It would also be good if the player could clear the drawing without having to re-start the game. Add this script to the Pencil sprite ..

 

 

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

 

 

12. So far, the player can only draw black lines. Let's give them a choice of colours ..

Select the Colour bar sprite and add this script to position it at the bottom of the stage ..

 

 

13. We will now add a script to the Pencil that changes the colour of the lines it draws when it touches a colour on the Colour bar.

Notice how the Pencil sprite pencil costume has a grey lead at its end ..

 

We will add a script to the Pencil that senses when this grey colour touches one of the colours on the Colour bar.

 

Add the following script to the Pencil. You will need to sample the Pencil lead carefully and then each colour in the Colour bar ..


 

 

14. Now change the "Pencil / rubber" sprite size from 100% to 30% ..

 

Press the "B" key to test your game. You should be able to change the line thickness, change its colour by touching a colour on the Colour bar, and clear your drawing by pressing the "C" key on your keyboard.

When you are ready press "E" to end your game.

 

 

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

 

You've finished this tutorial. Well done!