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 – drawing our first square


Let's start a new project and call it shapes. We'll work with the default cat sprite using the following steps:

  1. Add the when () key pressed block from Events, and choose the letter d for draw. We'll use this key to draw the shape.

  2. From the Pen palette, add the pen down block.

  3. Attach a move () steps block, and set a value of 50.

  4. After the move (50) steps block, add a turn () degrees block, and change the value to 90.

  5. Duplicate the move (50) steps and turn (90) degrees blocks three times. Your script should look like the following screenshot:

  6. Press the d key, and observe that the cat quickly draws a square as shown in the following screenshot. Press the d key repeatedly, and note that the shape doesn't change.

What just happened?

We drew a square even though it happened too quickly to see, and the cat is partially obstructing the line. We'll make our script more concise soon enough, but this simple script introduces us to the Pen blocks in scratch. By using...