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 Dessine un motif alternant (Défi)

Transcript

Hey, my name is KaMar and I am going to tell you about the “Draw an Alternating Pattern” add-on. In this add-on, you will draw and program two shapes to create an alternating pattern. To start, draw two new costumes for the pattern maker sprite. This example will demonstrate how to use the line, ellipse, and fill tools to make patterns, but you can draw your pattern however you’d like.

Select the pattern maker sprite and the costumes tab. Click paint new costume.

To create the first pattern, select the line tool and a color. Then, draw a series of overlapping lines. Use the fill tool to color this pattern. If you do something that you don’t like, click the undo tool. Once you’ve finished this pattern, center it using the “set costume center” button. Then, rename the costume. This example names it “line pattern.”

Click the “paint new costume” button to create the second pattern using the ellipse and fill tools. Similar to the line pattern, draw a series of ellipses, and use the fill tool to color them. The two patterns that you draw will be used together, so select colors for the ellipses that work well with the line pattern. Center this pattern using the “set costume center” button. Then, rename the costume. This example names it “circle pattern.” Next, program these new costumes to alternate to create a new pattern. Click the scripts tab. Duplicate a “key pressed” event block stack, and select a new key to start this code. This example will use “space.” This block stack is currently programmed to draw one shape. Select one of your new patterns in the “switch costume” block, click the flag, then press the selected key to run it. Great. To see how the second pattern looks, select the other costume in the “switch costume” block, and run it.

To alternate between costumes, switch costumes in the “repeat until” block.

Drag the “switch costume” block into the loop. When this code runs, the costume switches to the circle, the print prepare block creates the spacing and size for the pattern, then the sprite stamps. Click the flag, and press the selected key to try it. Great, it still works. Right click the "switch costume" block to duplicate this code stack, and place the new stack in the repeat until loop. Select the other pattern in the “switch costume” block. Click the flag to test and press a key. Whoa!

Both patterns show. Tinker with the values in the “print prepare” block to see different spacing and sizing looks. To find out what a value does, look at the define block. For example, the first value in the block controls the horizontal spacing.

Once you’ve programmed an alternating pattern, experiment with drawing different shapes, patterns, and colors to create new costumes. You can even try to use the vector editor to make alternating shapes that look like camouflage.

Now, it’s your turn: Draw two new costumes for the pattern maker sprite. Duplicate a “when key pressed” block stack, and change the value to a different key press. Add the “switch costume” block to the repeat loop, and duplicate the inner block stack.

Change the costume values to the two new patterns. Tinker with the values in the “print prepare” block to see how different sizing and spacing affects the pattern’s look.

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.
Lutin-Titre
Ajoute un titre à ton projet.
arrow_backward Retour
Suivant arrow_forward
Instructions
  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 !