Create & Learn
Background

Try Treasure Bounce for fun Scratch Project!

Treasure Bounce

Platform: Scratch
Level: intermediate

In this project, students will create a pinball-style game where the player uses the mouse to launch a small ball towards treasure boxes and blue diamonds. Each time the ball hits these objects, the player earns points. The ball will bounce around the screen, gradually slowing down until it disappears after a set time. This project will teach students about using variables to keep track of scores, sensing to detect collisions with objects, and controlling the motion of the ball to create an engaging experience.

Save to Account

Backdrop And Sprite Images For The Project

background
background
1024 x 1024
small ball
small ball
1024 x 1024
treasure box
treasure box
1024 x 1024
blue diamond
blue diamond
1024 x 1024

Treasure Bounce: Solution Outline

These are the high level steps to create this project. Try to create the project on your own first as much as possible, before checking the detailed solution samples below.

  1. Create the main sprites and set up the stage.
  2. Program the ball's movement and bouncing behavior.
  3. Detect collisions with treasure boxes and diamonds.
  4. Create a scoring system using variables.
  5. Add a timer to make the ball disappear after a set time.

Treasure Bounce Sample Solutions

This section provides detailed, step-by-step instructions on how to build the project. There are many ways to create a project, so feel free to explore different approaches. Please note that these instructions are Al-generated, so occasional errors may occur. Stay attentive as you follow along, and enjoy!

Create the main sprites and set up the stage.

Start by creating or selecting the sprites for the small ball, treasure box, and blue diamond. You can draw them yourself or choose from the Scratch library. Set up the stage with a simple background, like a plain color or a simple pattern, to make the objects stand out. Position the treasure boxes and blue diamonds around the stage where the ball will interact with them.

Program the ball's movement and bouncing behavior.

Use Scratch blocks to program the ball to move in a certain direction when the game starts. Use the 'when green flag clicked' block to start the game. Use the 'forever' loop to keep the ball moving. Use the 'if on edge, bounce' block to make the ball bounce off the edges of the stage. You can also use the 'point in direction' block to set the initial direction of the ball.

Detect collisions with treasure boxes and diamonds.

Use sensing blocks to detect when the ball touches a treasure box or a blue diamond. Use the 'if touching [sprite]' block inside the 'forever' loop to check for collisions. When a collision is detected, increase the score using a variable and make the ball bounce off in a new direction.

Create a scoring system using variables.

Create a variable named 'score' to keep track of the player's points. Initialize the score to 0 at the start of the game. Each time the ball hits a treasure box or diamond, increase the score by a set amount. Display the score on the screen using the 'show variable' block.

Add a timer to make the ball disappear after a set time.

Create a timer using a variable to count down from a set number of seconds. Use a 'repeat until' loop to decrease the timer variable by 1 each second. When the timer reaches 0, hide the ball to end the game.

Common Potential Issues in Treasure Bounce Project

It is common to have bugs in the code. Here are some of issues you might run into.

  • Ensuring the ball bounces correctly off the edges and objects, which might require adjusting the direction or speed.
  • Managing the score variable correctly so it accurately reflects the player's performance.
  • Making sure the timer works properly and the ball disappears at the right time.

Extra Challenges For Treasure Bounce

  • Add multiple levels with increasing difficulty by changing the speed of the ball or the number of treasure boxes and diamonds.
  • Introduce obstacles that the ball must avoid, which could decrease the score if hit.

Learn Scratch Coding Skills

Enroll your child in award-winning online Scratch coding classes led live by experts and designed by professionals from Google, Stanford, and MIT.

Scratch Junior

Scratch Junior

Grades K-2
Start coding with ScratchJr, and make interactive stories and games
Learn More
Scratch Ninja

Scratch Ninja

Grades 2-6
Code games and animations with beginner-friendly Scratch coding
Accelerated Scratch

Accelerated Scratch

Grades 5-9
Fast-paced introduction to coding: build games, stories, and animations
Intermediate Game Building with Scratch

Intermediate Game Building with Scratch

Grades 3-6
Code a new fun Scratch game every week

Explore More Fun Scratch Practice

The challenge continues: Enjoy even more Scratch tutorials dreamed up by other students or use your imagination to make your own!

backgroundTry The Tutorial
Develop My Own Idea