Skip to content

Please update your browser

Your browser version is not supported by this site. CS First may not work properly. Learn more

arrow_back Random Rebound

Transcript

This add-on will introduce a feature of Scratch and programming called randomness. Random means unpredictable or unexpected. In this add-on, you’ll program the ball to bounce in a random direction. This is a prompted add-on, which means you won’t see all the steps in the video. You’ll have to figure out some of it on your own.

From the “operators” menu, drag the “pick random” block into the scripts area.

The two values in the "pick random" block are the smallest and biggest values that will be picked randomly.

Figure out where in your ball sprite's bouncing code to place this block to make it pick a new, random direction when it bounces. The ball sprite’s bounce should still look normal, so these numbers should be close to the original number to make the bounce look realistic. Tinker around with them to see how they change the ball sprite's behavior. This may be a challenge. Try to figure it out yourself, but if you need help, ask your neighbor or the Host or Guru.

Here's the game plan: Figure out where to place the "pick random" block in the ball sprite's code. Adjust the values in the block to make a cool-looking random bounce.

Choose an Add-On
Bounce Reaction
Program the ball sprite to do or say something when it bounces.
Team Jersey
Design your athlete to reflect your favorite team.
Second Player
Add a second athlete to make a two player game.
Keep Score
Add a score counter to the game.
Play the Computer
Program a sprite to play against the user.
Random Rebound
Make the ball bounce in a random direction.
arrow_backward Back
Next arrow_forward
Instructions
  1. Choose an Add-On, and click "watch" to learn how to build it.
  2. Once you finish one Add-On, try another one below the video!