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 programtwo shapes to create an alternating pattern. To start, draw two new costumes for the patternmaker sprite. This example will demonstrate how to use the line, ellipse, and fill toolsto 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 overlappinglines. 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 costumecenter” button. Then, rename the costume. This example names it “line pattern.”
Click the “paint new costume” button to create the second pattern using the ellipseand fill tools. Similar to the line pattern, draw a series of ellipses, and use the filltool to color them. The two patterns that you draw will be used together, so selectcolors for the ellipses that work well with the line pattern. Center this pattern usingthe “set costume center” button. Then, rename the costume. This example names it“circle pattern.” Next, program these new costumes to alternateto create a new pattern. Click the scripts tab. Duplicate a “keypressed” event block stack, and select a new key to start this code. This example willuse “space.” This block stack is currently programmed todraw one shape. Select one of your new patterns in the “switch costume” block, click theflag, 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 switchesto the circle, the print prepare block creates the spacing and size for the pattern, thenthe sprite stamps. Click the flag, and press the selected key to try it. Great, it stillworks. Right click the "switch costume" block to duplicate this code stack, and place thenew 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 differentspacing and sizing looks. To find out what a value does, look at the define block. Forexample, 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 editorto make alternating shapes that look like camouflage.
Now, it’s your turn: Draw two new costumes for the pattern makersprite. Duplicate a “when key pressed” block stack,and change the value to a different key press. Add the “switch costume” block to therepeat 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.