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 Sélecteur de couleur


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.”

Choisir une extension
Bienvenue dans mon projet
Programme un lutin pour qu’il présente ton projet.
Sélecteur de couleur
Laisse l'utilisateur choisir la couleur du motif.
Dessine un motif alternant (Défi)
Crée un motif alternant unique.
Bande sonore (Défi)
Ajoute un fond sonore à ton projet.
Nouveaux tissus
Ajoute d'autres tissus à ton créateur de motifs.
Ajoute un titre à ton projet.
arrow_backward Retour
Suivant arrow_forward
  1. Choisis une extension, et clique sur "Regarder" pour découvrir comment personnaliser ton projet.
  2. Quand tu as fini, reviens à la page des extensions et essaies-en une autre !