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 the 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 behind the accessory remains on the screen and covers up the background that is being styled.

To fix this, drag out when I start as 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 top gives this away.

It performs the actions you code under it.

Click the 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 one is created.

Fix this by adding a wait block between the two blocks.

Test the code by clicking the flag again.

Now the clone trail deletes after one second.

Tinker with the value in the wait block so that the trail doesn't cover the screen for too long.

Once you find a value that you like, code the trail to be multicolored.

Remember that the change color effect block changes the color of your sprite.

From the looks menu, drag out a change color effect block into the scripts area and place it in your new code stack.

To repeat this color change, drag a repeat loop around the wait and change color effect blocks.

Click the flag to test your code.

Once you've clicked the flag and the stylist tool, the accessory follows the mouse pointer and creates clones of itself.

However, the trail's lasting longer than before.

That's because the program is changing the color of the accessory ten times every .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 ten 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 stamped 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 an if then block after the create clone of myself block.

From the sensing menu, add a space key press 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 entire clone trail.

Choose an Add-On
Flashy Mouse
Program your stylist tool create a colorful trail as it moves around the screen.
Stylist Game
Make your stylist tool into a game that lets the user race against the timer to style the model.
Animate Model
Program your model to animate when you place an accessory on it.
Stylist Critique
Create a stylist critic and program it to give feedback for the stylist project.
Sound (Challenge)
Add sound to your project.
arrow_backward Back
Next arrow_forward
Instructions
  1. Choose an Add-On, and click "watch" to learn how to build it.
  2. Once you finish one Add-On, try another one below the video!