Skip to content

Please update your browser

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

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.

Scegli un’estensione
Fare il restyling
Crea un nuovo accessorio per il tuo progetto.
Il mouse vistoso
Programma il tuo strumento stilista per creare una scia colorata che si muove all'interno dello schermo.
Il gioco dello stilista
Trasforma il tuo strumento da stilista in un gioco che permetta all'utente di sfidare il timer per abbigliare la modella.
Anima la modella
Programma la tua modella ad animarsi quando gli si pone sopra un accessorio.
Il critico di moda
Crea un critico di moda e programmalo affinché fornisca un feedback per il progetto dello stilista.
Il suono (Sfida)
Aggiungi dei suoni al tuo progetto
arrow_backward Indietro
Avanti arrow_forward
Istruzioni
  1. Fai clic su qualsiasi casella per controllare il video sui componenti aggiuntivi.
  2. Quando hai terminato, torna sulla schermata dei componenti aggiuntivi e prova un altro componente aggiuntivo.