Skip to content

Please update your browser

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

4. Cambia i tuoi accessori


Right now, your stylist tool only stamps one type of accessory. In this video, you’ll add more features to your stylist software, so the user will be able to press a key to change the type, color, and size of the accessory. To start, click the costume tab to check out the different types of accessory costumes. Remember from day 2 that you can click a costume to change it, but you can also program it to change with a “next costume” block.

In the scripts tab, click the looks menu, and drag out a “next costume” block.

To trigger this “next costume” block, you’ll need another event.

Drag out a “when space key pressed” block. Change the key to something that makes sense to trigger an accessory change. If you’re designing this software for a stylist, they should be able to easily understand which keys do what.

This example uses the right arrow. That seems like a “next costume” type of action.

Try it out. Remember to test your code after each step to find and fix problems, or bugs, as soon as they’re created.

Awesome,, now the arrow key triggers the sprite’s costume to change.

Next, program an event to change the accessory’s color.

Drag out a "change color effect by 25" block. Test some different values. Smaller numbers will change the accessory to a color that's slightly different, and larger numbers will change it to a color that's totally different.

This block needs to be triggered by an event, so drag out a “when key pressed” block, and change the key to something that makes sense for a color change. Test again. Awesome!

Next, change the size of the accessory. From looks menu, drag out a “change size by” block. Click it, and notice that the accessory gets larger. To make the sprite smaller, try a negative number. Now that you know which block makes the sprite larger and smaller, it’ll be up to you to figure out how to trigger it. You’ll need to use more than one event: one to make the sprite larger, and one to make it smaller.

You can also tilt your accessory by using another keypress event and a turn block from the motion menu. Tinker with these blocks if you have time to add extra features.

Once you program all the features, try them out. Use the stylist tool to accessorize your model. Make sure that everything works how you want it to, and if it doesn’t, tweak your program to make it better. Feel free to change the look of the background or the accessories. You can even add a new accessory costume!

Finally, tell users how to use your program. Save your project, then click "see project page." In the instructions section, write which keys to press to change the accessory type, size, and color. Also tell them how to stamp it.

Once you’ve finished programming the steps from this video, use your creativity to see what else you can add! Check out these other projects made by CS First students to get some ideas for your own project. Now, it's your turn. Add events that allow a user to change the type, size, and color of the accessory. When you're done, come back to this page and click the green “next” arrow to find out how you can customize your project with add-ons. Add instructions to your project page that tell the user which keys to press.

arrow_backward Indietro
Avanti arrow_forward
  1. Codifica una situazione pressione tasti per cambiare l'accessorio visualizzato
  2. Codifica una situazione pressione tasti per cambiare il colore dell'accessorio.
  3. Codifica una situazione pressione tasti per ridurre l'accessorio
  4. Codifica una situazione pressione tasti per ingrandire l'accessorio.