Book Image

Scratch 2.0 Beginner's Guide: Second Edition

By : Michael Badger
Book Image

Scratch 2.0 Beginner's Guide: Second Edition

By: Michael Badger

Overview of this book

Table of Contents (18 chapters)
Scratch 2.0 Beginner's Guide Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – cloning bricks


Our task is to take the single brick and continuously duplicate it until we create two solid rows of yellow bricks that span the width of the stage. As we work through the exercise, we'll make a couple of calculations to accomplish the task, and we'll tie it all together after we create the script. Let's follow the given steps for cloning bricks:

  1. Start the script with a when flag clicked block, and add the show block.

  2. We need to specify the starting point of the blocks, so add the go to x: y: () block from the Motion palette. We're going to assume a starting point on the left-hand side of the stage. Set the x: value to -216 and the y: value to 25.

  3. Add a repeat () block, and change the value to 10.

  4. From the Control palette, add the create clone of () block, and choose myself from the drop-down list.

  5. Add a go to x: () y: () block to the create clone of () block.

  6. From the Operators palette, drag the addition block (+) block into the x: value. From the Motion palette...