0% found this document useful (0 votes)
49 views20 pages

Module 4

The document provides instructions for creating a paint program in Scratch that allows the user to draw on the screen using different colored pencils and an eraser. It describes how to create selectable pencil sprites for different colors, make the pencil follow the mouse and draw when clicked, add variables to control pencil width, and add buttons and messages to switch between tools and clear the screen. The instructions also suggest adding keyboard shortcuts and allowing the user to draw shapes as potential enhancements.

Uploaded by

thiaga77
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views20 pages

Module 4

The document provides instructions for creating a paint program in Scratch that allows the user to draw on the screen using different colored pencils and an eraser. It describes how to create selectable pencil sprites for different colors, make the pencil follow the mouse and draw when clicked, add variables to control pencil width, and add buttons and messages to switch between tools and clear the screen. The instructions also suggest adding keyboard shortcuts and allowing the user to draw shapes as potential enhancements.

Uploaded by

thiaga77
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

MODULE 5:

Paint
program
× First you need to paint your drawing tool, a pencil
× One important step here! Set your pencil costume’s
center to be at the tip of your pencil

× Great! Now you have a pencil. Make sure to name it


‘blue colour’
× You will be using the mouse to draw so you’ll want
the pencil to follow the mouse forever.

× Add the following code to your pencil sprite:

× Test it out! Does it follow your mouse around?


× Let’s make your pencil draw if the mouse has been clicked

× Add this code to your pencil sprite:

× Test it out!

× Hint: You can clear the stage with this block


× Right now your pencil can draw only 1 colour.
Let’s add more colours to allow users to
choose!

× Click on your pencil sprite and click ‘Costumes’


then duplicate your pencil
× Rename your new costume ‘green colour’ and
colour it green
× Create 2 new sprites which you will use to select
blue or green pencil.
× When the green selector icon is clicked, you need
to broadcast a message to the pencil sprite,
telling it to change its costume and pencil
colour.

× First add this code to the green selector icon


× You now need to tell your pencil sprite what to
do when it receives the message:
× Now do the same for the blue selector sprite

× And your pencil


× Finally, add this to your pencil code so that it
clears the board when you start your program

× Test it out! Does it work?


1. Add more pencil colours!

Red
Yellow
Black

2. Add an eraser

Hint: An eraser is like a white pencil


× Let’s add a button to clear the stage.

× Add a new sprite and add the following code to it

× Test it out!
× Let’s allow the user to draw using different pencil sizes.

× First, create a new variable called ‘width’.

× Add this code inside your pencil’s code within the


forever loop
× You can change the number stored in this
variable by using a slider.

× Test it out!
× You can set the minimum and maximum value of
your width if you want.
1. Can you create keyboard shortcuts for your
commands? For example:

b = Switch to blue pen


g = Switch to green pen
e = Switch to eraser
c = Clear screen
× What can they draw?

You might also like