Skip to content

Please update your browser

Your browser version is not supported by this site. CS First may not work properly. Learn more

arrow_back Color Picker (Part 1 of 2)

Transcript

In this add-on, you will make the painter’s palette on the stage clickable.

This will allow the artist to select a color to draw with.

First, select the pencil sprite and the "pen" menu.

There are three colors for the artist to choose from, so drag out three "set pen color to" blocks.

To set the color value in these blocks, click the color swatch, move the mouse over the color you would like to select, and click.

Make the color value in each block match one of the colored dots in the painter’s palette.

To test a block, click the flag, then click one of the “set pen color” blocks, and draw.

Great.

Add an event to tell the computer when these blocks should run.

These blocks will run when the dot sprites are clicked.

To make one sprite affect another sprite, broadcast a message between them.

Click "dot 1," and drag out a "when this sprite clicked block."

To make the dot 1 sprite broadcast a message when clicked, drag out a "broadcast" block, and attach it to the "when this sprite clicked" event.

Click the dropdown, and create a new message.

Name it the color of the dot, which in this example is "blue."

Then, click the pencil sprite, add a "when I receive" block, and change the message to "blue."

Try it out.

Click dot 1, and start drawing.

Cool!

When you click the dot, it broadcasts the message "blue," the pencil receives the message, and it changes the pen color to blue.

Next, make the other dot sprites broadcast messages as well.

This example fast forwards through these steps, as they are the same ones you used to program the first dot.

Once you have made all three colors on the palette clickable, try it out!

Then, play the game with a friend.

It’s fun to see how this new feature makes the game more colorful!

Now it’s your turn: Select the pencil, and add three "set pen color" blocks.

Set the color in each block to one of the dot colors.

For each dot, use a "when this sprite clicked" and a "broadcast" block.

Create a new broadcast message for each color.

Select the pencil again, and add three "when I receive blocks" with the correct message in each.

Choose an Add-On
Color Picker (Part 1 of 2)
Lets the user change the color of the pen.
Color Picker (Part 2 of 2)
Lets the user change the color of the pen.
Pen Size Adjustment
Allow the users to change the size of the pen.
Monkey Animation
Make the Monkey do a little dance and introduce the game.
Draw inside the lines
Make it impossible to draw outside the white spaces.
Sound Effects
Add sound to your game.
arrow_backward Back
Next arrow_forward
Instructions
  1. Choose an Add-On, and click "watch" to learn how to build it.
  2. Once you finish one Add-On, try another one below the video!