How to use the Stop Block

Today, we are focusing on a crucial control block in ScratchJr: the Stop block. While the Repeat Forever block is fantastic for creating continuous motion, the Stop block gives you the precise control needed to pause or stop a specific script without resetting the entire project.

Our project today will demonstrate a continuous loop: Kitten running across the road to get a basketball. This teaches children how to manage an infinite loop and manually stop the character’s movement.

Setting Up the Continuous Loop

For a continuous, looping action, we need a setting that allows for repeated movement.

  1. Change the Background: Select the suburbs background, which features a road. [00:22]
  2. Add the Target: Add the Basketball character to the project. [00:33]
  3. Position Characters: Place the basketball on the far side of the road at the bottom of the screen. Kitten should be positioned near the top of the screen, ready to run. [00:46]

We will only be coding the Kitten icon.

Coding Kitten: The Infinite Runner

Kitten’s script will be set up to move down and then immediately jump back to the top of the screen, creating a continuous running loop.

  1. Start Block: Begin with the Green Flag trigger block (yellow category). [00:57]
  2. Movement: Go to the blue Motion category and add the Move Down block. [01:05]
    • Note: Since Kitten will wrap around the screen in a loop, you do not need to set a specific number for the steps here.
  3. The Loop: Go to the red Control category and add the Repeat Forever block to the end of the script. [01:12]

When you run this code, Kitten will move down, vanish off the bottom of the screen, and instantly reappear at the top, creating a continuous loop that runs forever. [01:35]

Using the Stop Block

Now, here is how you control that infinite loop using the Stop block.

  1. Place the Stop Block: Go to the orange Control category and select the Stop block (the red square). Place it on the coding canvas next to Kitten’s main scriptIt is not attached to the script itself. [01:16]
  2. Running the Code: Press the Green Flag to start the infinite loop.
  3. Stopping the Code: While the program is running (in the small-screen view), simply tap the Stop block on the canvas. This will immediately stop Kitten’s repeating movement! [01:42]

It is important to note that the Stop block only works when the coding canvas is visible. It cannot be pressed when the animation is in full-screen mode. [01:49]

Mastering the Stop block is an important skill in our coding tutorials for teaching children how to control continuous code sequences. For structured activities, explore our collection of ready-made lessons. Happy coding!