Time for action – ricocheting off bricks
Right now, the ball bounces off the edge and ricochets off the paddle, but it continues passing through the bricks. We're going to change that behavior by making the ball bounce off the bricks. Let's follow the given steps:
Select the yellow brick sprite. Add a broadcast () block to the script that checks if the brick touches the ball, and create a new message called bounce. See the following screenshot:
Tip
Troubleshoot with the say block
If you're having problems with a script or you want to be sure a certain part of the script is working, you can add a say () block, as seen in the previous screenshot. When the condition is met, a quick Hello! appears on the screen.
Select the ball sprite, and add the when I receive block to the scripts area.
Attach a point in direction () block.
We're going to do a calculation inside the point in direction () block to redirect the ball back to the paddle. Add a multiplication (*) block from the Operators palette. Then...