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.

Choisir une extension
Relooker
Crée un nouvel accessoire pour ton projet.
Souris flashy
Programme ton outil de stylisme pour créer une trace de couleur lorsqu'il se déplace sur l'écran.
Jeu de stylisme
Transforme ton outil de stylisme en un jeu qui permet à l'utilisateur de faire une course contre la montre pour habiller le mannequin.
Animer le mannequin
Programme ton mannequin pour qu'il s'anime quand tu places un accessoire sur lui.
Critique de mode
Crée un critique de mode et programme-le pour qu'il commente le projet de mode.
Son (Défi)
Ajoute du son à ton projet.
arrow_backward Retour
Suivant arrow_forward
Instructions
  1. Clique sur l'une des fenêtres pour voir la vidéo sur les extensions.
  2. Quand tu as fini, reviens à la page des extensions et essaies-en une autre !