In this project, players practice shooting hoops by clicking to throw a basketball into a moving hoop. The hoop moves left and right across the screen. If the basketball touches the hoop while moving, the player scores points and hears a cheering sound. The basketball character switches costumes to show different emotions based on how many points they have scored. Players can repeat the shooting to improve their score.
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.
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 errors may occur and the coding blocks may not map to Scratch exactly. But it should serve as very valuable references. Stay attentive as you follow along, and enjoy!
Start by creating a basketball sprite. You can either draw it or choose one from the Scratch library. Place the basketball at the bottom of the screen, ready to be thrown upwards. This will be the starting position for each shot.
Draw or select a hoop sprite. Use a simple motion block to make the hoop move back and forth across the screen. You can use a 'forever' loop with 'if on edge, bounce' to keep it moving continuously.
Use an event block to detect when the basketball is clicked. When clicked, the basketball should move upwards. Use a conditional statement to check if the basketball is touching the hoop. If it does, play a cheering sound and increase the score.
Create different costumes for the basketball to show different emotions. Use conditional statements to switch costumes based on the score. For example, a happy face for a high score and a sad face for a low score.
After each shot, reset the basketball to its starting position and allow the player to shoot again. This can be done by resetting the y position of the basketball and waiting for the next click.
It is common to have bugs in the code. Here are some of issues you might run into.
Enroll your child in award-winning online Scratch coding classes led live by experts and designed by professionals from Google, Stanford, and MIT.
The challenge continues: Enjoy even more Scratch tutorials dreamed up by other students or use your imagination to make your own!
Explore your child's grade level to find computer science classes and learning pathways that set your student up for success.