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 Bunte Spuren hinterlassen

Transcript

In this add-on, you’ll program your stylist tool to create a colorful trail as it moves around the screen. Make sure the stylist sprite is highlighted.

The colorful trail will be created by clones, or copies of the original sprite. To make clones, add a “create clone of myself” block under the “go to mouse-pointer block.”

Try it out. The sprite creates a trail as it moves across the screen.

On the stage, the trail left by the accessory remains on the screen and covers up the background that is being styled. To fix this, drag out “when I start as a clone” and “delete this clone” blocks, and snap them together. The “When I start as a clone” block is an “event” block. The shape on the top gives this away. It performs the actions you code under it.

Click the green flag to run the code. The stylist tool does not show a trail because the code tells the sprite to delete the clone as soon as it is created. Fix this by adding a “wait” block between the two blocks. Test the code by clicking the green flag again.

Now the clone trail deletes after 1 second. Tinker with the value in the “wait” block so the trail that doesn’t cover the screen for too long.

Once you find a value that you like, code the trail to be multi-colored. Remember that the “change color effect by” block changes the color of your sprite.

From the looks menu, drag out a “change color effect by” block into the scripts area, and place it in your new code stack. To repeat this color change, drag a “repeat” loop around your “wait” and “change color effect by” blocks. Click the green flag to test your code. Once you click the green flag and the stylist tool, the accessory follows the mouse-pointer and creates a clones of itself. However, the trail is lasting longer than before! That’s because the program is changing the color of the accessory 10 times every 0.2 seconds. To fix that, change the value in the “wait” block to a smaller number.

Every time the clone is created, it changes its color effect, waits .02 seconds before changing again 10 times, then deletes itself. This creates a fading, color-changing trail.

Test the code again. Click the flag, move the mouse pointer, and click space to stamp the accessory. Oh no, it stamps the entire clone trail. To make the sprite stamp only itself and not the clone trail, add a conditional statement. From the control menu, add a "if-then" block after the "create clone of myself" block. From the sensing menu, add a "space key pressed" block to the if portion of the "if-then" block. From the scripts area, drag the "stamp" block to the then portion of the block. The "when space key pressed" block is no longer needed, so delete it by right clicking the block and selecting delete. Test again. Click the flag, move the mouse pointer, and click space. Great! Now, the sprite stamps only once, instead of stamping the entire clone trail. Now, it’s your turn!

Program the accessory sprite to leave behind a colorful trail of clones.

Program the sprite to stamp only a single copy of itself, instead of stamping the clone trail.

Erweiterung auswählen
Kostüme umgestalten
Ein neues Accessoire für euer Projekt erstellen.
Bunte Spuren hinterlassen
Euer Modeschöpfer-Werkzeug so programmieren, dass ihr damit eine farbige Spur auf dem Bildschirm hinterlassen könnt.
Ein Modeschöpfer-Spiel programmieren
Euer Modeschöpfer-Werkzeug in ein Spiel verwandeln, mit dem der Nutzer das Model im Wettlauf gegen die Zeit stylen muss.
Das Model animieren
Euer Model so programmieren, dass es sich bewegt, wenn es ein neues Accessoire erhält.
Feedback hinzufügen
Ein Programm erstellen, um das Modeschöpfer-Projekt zu bewerten.
Einen Klang hinzufügen (Herausforderung)
Eurem Projekt einen Klang hinzufügen.
arrow_backward Zurück
Weiter arrow_forward
Anweisungen
  1. Klickt auf ein beliebiges Feld, um zum Erweiterungs-Video zu gelangen.
  2. Wenn ihr fertig seid, kehrt zum Erweiterungen-Bildschirm zurück und probiert eine andere aus!