Create & Learn
Background

Try Hoop Star: Precision Shooter for fun Scratch Project!

Hoop Star: Precision Shooter

Platform: Scratch
Level: intermediate

Control the jersey-wearing Cat as it moves left and right across the court using the arrow keys. Press and hold the Spacebar to charge a 'Power' variable. Upon release, the Cat creates a clone of itself that switches to a basketball costume, launching toward the hoop using advanced parabolic motion. Use sensing blocks to detect if the basketball clone touches the hoop, triggering a 'Goal' broadcast that increments the 'Score' variable and resets the Cat's position.

Backdrop And Sprite Images For The Project

background
background
1280 x 896
cat with basketball jersey
cat with basketball jersey
1024 x 1024

Hoop Star: Precision Shooter: 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. Set Up Variables, Costumes, and Basic Movement
  2. Create the Charging System with the Spacebar
  3. Launch the Basketball Clone using Parabolic Motion
  4. Handle Goal Scoring and Resetting

Hoop Star: Precision Shooter 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 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!

Set Up Variables, Costumes, and Basic Movement

Initialize the game environment. Add two costumes to your Cat sprite: one with the Cat in a basketball jersey, and another showing just the basketball. Create three variables for all sprites: 'Score', 'Power', and 'Gravity'. Write a script to let the Cat walk left and right across the bottom of the screen using the Arrow keys.

Create the Charging System with the Spacebar

Program the Spacebar to charge up your shot. While holding down the Spacebar, the 'Power' variable will steadily increase up to a maximum limit. Once the Spacebar is released, the Cat will trigger a clone of itself to act as the basketball.

Launch the Basketball Clone using Parabolic Motion

Configure the clone's behavior. When the clone starts, immediately switch its costume to the basketball. Use the 'Power' value to set its horizontal speed (X velocity) and vertical starting push (Y velocity). Use a loop to update the basketball's position, gradually decreasing its vertical speed to simulate realistic gravity.

Handle Goal Scoring and Resetting

Create a separate target sprite for the Hoop. When the Hoop receives the 'Goal' message, it increases the 'Score' variable, plays a sound, and broadcasts a reset command to return the jersey-wearing Cat to its starting position for the next shot.

Common Potential Issues in Hoop Star: Precision Shooter Project

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

  • Clones wearing the wrong costume: Ensure that the main Cat sprite always switches back to the jersey costume, and the clone instantly switches to the basketball costume upon creation.
  • Uncontrolled power infinite loop: If the 'repeat until not Space pressed' loop doesn't have a small wait block, the Power variable will instantly max out, making precision control impossible.
  • Clones not disappearing: Ensure the 'delete this clone' block is placed both inside the Hoop collision check and at the very end of the motion loop to prevent basketballs from sticking to the edges of the screen.

Extra Challenges For Hoop Star: Precision Shooter

  • Moving Hoop: Program the hoop sprite to slide up and down, or left and right, to make aiming your charged parabolic shot much more challenging.
  • Dynamic Wind Resistance: Add a random 'Wind' variable at the start of each shot that pushes the ball slightly left or right, forcing the player to adjust their power calculation.

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
Scratch Ninja
Free Intro
Scratch Ninja

Grades 2-6

Code games and animations with Scratch coding, beginner to advanced levels
Accelerated Scratch
Free Intro
Accelerated Scratch

Grades 5-9

Fast-paced introduction to Scratch 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!

Develop My Own Idea

Find Best Classes For Your Child

Explore your child's grade level to find computer science classes and learning pathways that set your student up for success.