Skip to content

Please update your browser

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

5. Copying Code

  • 1. Activity 7 Survey
  • 2. Introduction to Architecture
  • 3. Creating Clones
  • 4. Creating Stamps
  • 5. Copying Code
  • 6. Clear Button
  • 7. Add-Ons
  • 8. Reflection
  • 9. "Repeat Until" in the World Around You
  • 10. Wrap-up: Share Your Project
  • 11. Wrap-up: Show Your Project
arrow_backward Back Next arrow_forward
Transcript

Each of the stamp sprites in this project will share the same code. Sprites can share code using something called the backpack. At the bottom of the screen, you will notice a tab with the word “backpack.” Click the tab to open the backpack, then drag the code you will share into it. Now, click on a sprite to share that code with.

This example uses the dome. Drag the code from the backpack into the scripts area of the dome. The code should show up for the dome sprite!

Test that the code works on the new sprite. It should do exactly what the arch does.

Click on the sprite you just dragged the code into, drag the clone with your mouse pointer, then click the mouse pointer to leave a stamp. Drag the code out of your backpack for each sprite.

The backpack can save and share code, backdrops, and sprites between Scratch projects.

Use it to quickly copy your favorite code or sprite into another project.

Now, it’s your turn! Make the other stamp sprites do the same thing the arch does. Drag the code from the arch sprite into the backpack. Then, drag the code from the backpack to each of your other sprites.

Instructions
  1. Open the backpack.
  2. Drag the code from the arch sprite into the backpack.
  3. Drag the code from the backpack into the other sprites.