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 – animating a radar screen


To pull off a radar pattern, we'll rotate straight lines around a circle, but we'll need to draw upon our earlier work with colors to make the animated effect. Let's create a new stack of blocks by performing the following steps:

  1. Let's initialize our starting point with the following blocks:

    • clear

    • go to x: () y: ()

    • set pen shade to (50)

    • pen down

  2. Then add a forever block. We want to repeat the following set of blocks:

    • set pen size to (1)

    • turn (90) degrees

    • set pen color to (15)

    • move (60) steps

    • move (60) steps

    • set pen size to (1)

    • set pen color to (101)

    • move (-120) steps

    • turn (1) degrees

  3. When you run the script, you should get a pattern similar to the following screenshot. As the pattern repeats, the thin, dark lines create a movement around the center point while the background color remains solid. It's a relatively noisy pattern.

    Tip

    To speed up the pattern, use the turbo mode by shift-clicking the green flag.

  4. Now let's experiment a bit. To...