Code a Bouncing Ball Game
Green highlight

Use Scratch to code a bouncing ball game, make the ball bounce, add controls and scoring, and learn basic programming concepts.

Orange shooting star
Download Guide
Collect Badge
Background blob
Challenge Image
Skill Badge
Table of contents

Step-by-step guide to code a bouncing ball game

What you need
Keyboard, mouse or trackpad, scratch account or access to scratch

Step 1

Open the Scratch website or app and click Create to start a new blank project.

Step 2

Delete the default cat sprite by selecting it and clicking the trash icon.

Step 3

Add a Ball sprite from the sprite library or draw a round sprite and place it near the top center of the stage.

Step 4

Add a Paddle sprite by painting a rectangle or choosing one and move it to the bottom center of the stage.

Step 5

Create three variables named xVelocity yVelocity and score for all sprites.

Step 6

On the Ball add a "when green flag clicked" script that goes to x:0 y:100 sets xVelocity to pick random -4 to 4 sets yVelocity to 8 and sets score to 0.

Step 7

On the Ball add a forever loop that changes x by xVelocity changes y by yVelocity and changes yVelocity by -0.5 each loop to simulate gravity.

Step 8

Inside that Ball loop add an "if touching Paddle" block that sets yVelocity to 8 changes xVelocity by pick random -1 to 1 and changes score by 1.

Step 9

Inside the Ball loop add an "if y position < -170" block that uses the "stop all" block to end the game when the ball falls below the stage.

Step 10

On the Paddle add a "when green flag clicked" forever script that if key right arrow pressed change x by 10 and if key left arrow pressed change x by -10 so you can move the paddle.

Step 11

Click the green flag to play and tweak numbers like xVelocity yVelocity or the gravity value until the ball bounces and feels fun.

Step 12

Share your finished bouncing ball game on DIY.org

Final steps

You're almost there! Complete all the steps, bring your creation to life, post it, and conquer the challenge!

Complete & Share
Challenge badge placeholder
Challenge badge

Help!?

What can I use if I can't access the Scratch website or can't find the Ball or Paddle sprites?

Use the Scratch Offline Editor or ScratchJr on a tablet, or open the costume editor and paint your own Ball and Paddle sprites and name them exactly Ball and Paddle so the scripts like 'if touching Paddle' work.

Why does the ball sometimes pass through the paddle or not bounce?

Check that you made xVelocity and yVelocity variables for all sprites, that the 'if touching Paddle' block is placed inside the Ball's forever loop, and that the Paddle is positioned near the bottom of the stage so collisions register.

How can I adapt this activity for different age groups?

For younger kids use a larger Paddle costume, slower speeds (set yVelocity to 6 and change x by 5) and guided step-by-step help, while older kids can increase gravity or xVelocity ranges, add multiple balls, or create level challenges using the score variable.

How can I personalize or extend the bouncing ball game?

Add sounds to the Ball's 'if touching Paddle' block, create a lives variable and change the 'if y position < -170' block to subtract a life instead of 'stop all', increase difficulty when score reaches thresholds, and customize backgrounds and Ball costumes before sharing on DIY.org.

Watch videos on how to code a bouncing ball game

Here at SafeTube, we're on a mission to create a safer and more delightful internet. 😊

How to Make a Hover Ball Toy Easy | Fun DIY with Straws

4 Videos

Facts about Scratch programming

💥 Collision detection — checking when two sprites touch — is the trick that makes balls bounce and players score.

🧩 In Scratch, game objects are called "sprites" and each sprite can have its own scripts, costumes, and sounds.

🔁 Many beginner bouncing-ball games simply reverse the ball's velocity on impact instead of simulating full physics to keep the code simple and fun.

🎮 Pong was released in 1972 and helped popularize simple two-dimensional bouncing-ball gameplay.

🐱 Scratch's mascot is a cat, and Scratch uses colorful drag-and-drop blocks to teach coding to millions of kids.

How do you code a bouncing ball game in Scratch?

Start a new Scratch project, create or choose a ball sprite and a stage background. Add motion scripts: use a forever loop to change y by a velocity variable and apply gravity by decreasing velocity each tick. Use "if on edge, bounce" or detect collisions with a paddle sprite to reverse velocity. Add keyboard events for paddle movement, a score variable that changes on hits, and test, debug, and refine.

What materials do I need to make a Scratch bouncing ball game?

You need a computer or tablet with internet and a browser, or the Scratch offline editor. A free Scratch account is optional for saving and sharing projects. Have a mouse or trackpad and keyboard for controls. Optional materials: headphones for sounds, a printed plan or sketch paper to design levels, and an adult nearby to help younger kids with account setup and troubleshooting.

What ages is coding a Scratch bouncing ball game suitable for?

Scratch is great for kids roughly 7–14. Younger children (ages 7–9) can build a simple bouncing game with adult help for reading blocks and managing accounts. Ages 9–12 can add scoring, collisions, and basic variables independently. Teens can extend the game with levels, lists, and custom blocks for more advanced programming concepts and creativity.

What are the benefits of coding a bouncing ball game in Scratch?

Building a bouncing ball game teaches sequencing, event-driven thinking, variables, conditionals, and debugging. Kids practice problem-solving, creativity, and persistence while designing sprites and rules. It also introduces basic physics ideas like velocity and collision. Sharing the project encourages communication and feedback. For safety, avoid sharing personal info on profiles and supervise account use and online interactions.
DIY Yeti Character
Join Frame
Flying Text Box

One subscription, many ways to play and learn.

Try for free

Only $6.99 after trial. No credit card required

Code a Bouncing Ball Game. Activities for Kids.