Skip to content

Please update your browser


3. Estampiller l'accessoire


Now that you’ve programmed the accessory to follow the mouse, you need a way to stamp the accessory onto the stage. From the “pen” menu, drag out a “stamp” block. Click it, then move the accessory. Notice that the sprite is now stamped on the stage. Making the sprite stamp is easy, but how do you make the accessory stamp while it’s following the mouse?

To run the “stamp” block now, you have to click it, which you can’t do while the accessory is following the mouse. [pause to demonstrate] To trigger the stamp to run, you’ll need an event.

From the events menu, drag out a “when key pressed” event block, and attach it to the “stamp” block. Notice that the key in the dropdown is set to “space key.”

Try it out! Click the flag, move the accessory around, and when you want to stamp the accessory, press the space key. Don’t worry if you tested a solution, and it didn’t work. That happens all the time in computer science! Keep coding, testing, and trying solutions until you find one that works.

Awesome, now you can move the accessory around the stage and stamp it.

This stage is getting a little crowded. To clear stamps when this program starts, add a “clear” block between the "when flag clicked" and "forever" blocks.

The stylist can now create a new set of accessories each time the flag is clicked.

Now, it’s your turn, Combine a “stamp” block, with a “when key pressed” event to stamp the accessory on the stage. Clear the stamps from the screen using a “clear” block. In the next video, you'll get a chance to change up your accessories.

arrow_backward Retour
Suivant arrow_forward
  1. Ajoute un évènement "Quand ce lutin est cliqué".
  2. Crée un tampon de l'accessoire quand tu cliques sur le lutin.
  3. Vide l'écran lorsque le drapeau vert est cliqué.