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 – changing a sprite's direction


Why does the point in direction () block use the calculation 180 - direction? Let's answer that question by experimenting with some new directions as given in the following steps:

  1. Select the ball sprite from the sprites list, and find the script that contains the point in direction () block. See the following screenshot:

Find the calculation used to redirect the ball and change 180 to 90:

  1. Play the game and observe the results.

  2. Let's simplify the direction change. Drag the green number block that currently contains the calculation 90 - direction out of the value of the point in direction() block. You can drag it down to a blank spot in the scripts area.

  3. Change the value of the point in direction block to 180. Click the green flag to play. Observe the results. The ball should always fall through the paddle and to the bottom of the screen.

  4. Change the value of the point in direction () block to 0. Click the green flag to play. This time the ball bounces...