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 – determining if the ball is below the paddle


In the starter project, the game is over when the ball touches the color red, which matches the color of the strip at the bottom of the stage. Red is going to be one of our brick colors, so we'll want to adjust our game over condition to be a neutral color.

Basically, we need to determine if the ball falls below the paddle, but in doing so, we're going to encounter some problems that we'll need to solve. Let's follow the given steps:

  1. The game over condition is set by the ball sprite. So select the ball, and remove the touching color ()? block from the value of the wait until () block.

  2. Replace touching color ()? with the less than block (<) from the Operators palette.

  3. From the Motion palette, find the y position block, and add it to the left-hand side of the less than (<) block.

  4. From the Sensing palette, add the block that reads (x position) of paddle to the right-hand side of the less than (<) block. Change x position to y...