Skip to content

Please update your browser

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

Choose an Add-On
play_circle_filled
Welcome to My Project
Program a sprite to introduce your project.
arrow_forward
play_circle_filled
Color Selector
Enable the user to pick the color of the pattern.
arrow_forward
play_circle_filled
Alternating Patterns (Challenge)
Create a unique alternating pattern.
arrow_forward
play_circle_filled
Soundtrack (Challenge)
Add background music to your project.
arrow_forward
play_circle_filled
New Fabrics
Add more fabrics to your pattern maker.
arrow_forward
play_circle_filled
Title Sprite
Add a title slide to your project.
arrow_forward
  • 1. Activity 7 Survey
  • 2. Introduction To Procedures
  • 3. Print Your Pattern
  • 4. Reset the Project for Another Print
  • 5. Pattern Explorer
  • 6. Add-Ons
  • 7. Reflection
  • 8. Wrap-up: Pattern Maker
  • 9. Wrap-up: Share Your Project
  • 10. Wrap-up: Show Your Project
arrow_backward Back Next arrow_forward
Transcript

Note that this add-on works best when sprites are a single color.

To begin, click the pattern maker sprite, then the costumes menu.

An easy way to create different-colored costumes is to duplicate a costume and fill it with different colors. To accomplish this, right click a costume, then click “duplicate.” Click the duplicated costume, select a different color you like, then click the "color a shape" icon. Now, click the parts of the image you want to fill with a new color.

You can repeat this process a couple of times. It's tempting to create costumes that are every color of the rainbow, but for now limit yourself to four different costumes. You can always go back and add more costumes later, but right now you want to leave enough time to finish coding your project.

Rename each of the costumes to reflect their colors. In this example, the costumes are named blue, red, yellow, and black.

Next, add a sprite that will ask the user what color the pattern should be. If you completed the Pattern Project Introduction add-on, you might have already added a sprite that could ask this question. If not, click the "add sprite from library" icon, and select a sprite.

Next, add an "ask" block from the sensing menu. In the field, ask what color the user wants the sprite to be and specify which colors are available.

To change the sprite's costume based on the user’s answer, create a conditional statement.

Under the “ask” block, add an “if-then” block. Then, place an "equals" block from the operator menu in the “if” portion of the “if-then” block. Next, add an "answer" block to one side of the "equals" block. On the other side, enter the color of one of the costumes.

Next, place a "broadcast" block in the "then" portion of the "if-then" block. From the dropdown menu of the “broadcast” block, select "new message," and call the message the same name as the color.

In this example, the code says: If the user's answer equals red, then broadcast the message “red.”

Now, switch to the "pattern maker" sprite. This step is really important because this sprite is the one you will program next.

Drag out the "when I receive" block, and select the message you just created from the dropdown menu.

Duplicate the code below the "when 1 key pressed" block, and add it to the bottom of this code stack.

In the switch costume block, choose the correct color costume from the dropdown menu.

Now, the user is able to choose one color.

Each time you broadcast a message for a color, make sure the correct color costume is selected. Finally, select the sprite that will ask the user which color pattern they want to see. Add an event that triggers the sprite to ask this question. In this example, the sprite asks the question when the green flag is clicked.

But, you can use another event, like “when this sprite clicked” or “when space key pressed.”

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!