Please update your browser
Your browser version is not supported by this site. CS First may not work properly.
In this add-on, you will make it possible
to change the paint color when the user presses a key
by adding a keypress event.
This type of event makes a specific action occur
in your program when a user presses
a certain key on the keyboard,
such as the space bar, a number, or a letter.
Find the when space key pressed blocked under Events
and drag it out.
You can set the keypress to any key.
This example uses the right arrow.
Next, from the Looks menu,
select a change color effect by 25 block.
Now you can press the right arrow key
to change the paint color.
Computer scientists use their imaginations
in their projects all the time!
They also explore new and different ideas.
Check out some of the other change effect options
available in Scratch that you can add to your code.
Using the same concepts you just saw in this video,
you could make keypress events that control
just about any part of your project,
including the brightness and size.
Computer science doesn't have many limits.
If you can think of it, you can create it!
Finally, add instructions letting the user know
that pressing whatever key you chose
will change the color of the brush.
Now it's your turn.
Use a keypress event and the change color effect by 25 block
to change the paint color when the user presses a key.
Experiment with more keypress events
and change effect by blocks to create
more cool art effects in your project.
Finally, add instructions to your project.