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 – building on the square


Let's clean up our code, get back to a common starting position, and explore some additional shapes by performing the following steps:

  1. After the when (d) key pressed block, add a hide block and a clear block from the Looks and Pen palettes, respectively. This will hide the sprite and remove the previous drawing if any.

  2. After the clear block, add the go to x: (0) y: (0) and point in direction (90) blocks.

  3. Now, attach a repeat () block to pen down. Then drag the move (50) steps and turn (90) degrees blocks inside the repeat () block. Delete the remaining move and turn blocks.

  4. Change the value in the repeat () block to 4.

  5. At the end of the stack, add the pen up block.

  6. Double-check your work by pressing the d key. You should get a square, and the cat should be hidden. The final script should look like the following screenshot:

  7. Now, change the value in the repeat (4) block to 3 and in the turn (90) degrees block to 120 to get a triangle.

  8. Next, try repeating a...