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 – setting the starting position and the direction


Let's take what we learned about the point in direction () block and apply it to the starting position of the ball. We'll also set the starting coordinates because the ball currently starts above the row of bricks. Let's follow the given steps for setting the starting position and the direction:

  1. Change the starting x and y coordinates in the go to x: y: block to be -200 and -25. The value -25 will keep us below the bricks, and -200 positions the sprite on the left-hand side of the stage.

  2. We want to make sure the ball moves down at the start of the game. Add a point in direction () block. Change the value to 135. The revised script can be seen in the following screenshot:

  3. As you play the game, note the direction being reported in the direction stage monitor.

What just happened?

The initial starting position of the ball was above the yellow bricks, so our first tweak starts the ball below the bricks on the left-hand side of the...