How to Run Two Programs Simultaneously on One ScratchJr Character

Are you looking for a way to add more complexity and realism to your young coder’s animations? In this ScratchJr tutorial, we’re going to tackle a fantastic skill: running two completely separate programs for a single character at the exact same time! This is the key to creating smooth, compound movements.

Our project today will demonstrate this by making a basketball move horizontally and vertically simultaneously, showing Kitten shooting the ball straight into the net.

Setting Up Your Scene

To begin, we need a suitable background and the necessary characters:

  1. Change the Background: Choose the gym or sports court background for your project. [00:26]
  2. Add Characters: Add the Kitten character and the Basketball character. [00:38]
  3. Position Characters: Place Kitten in a realistic throwing position, and place the Basketball near them. Ensure the basketball net is visible in the background. [00:43]

Since the basketball is the object that will be moving in two directions at once, ensure the Basketball icon is selected on the left to begin coding.

Coding the Horizontal Movement (Program 1)

The first program will handle the basketball’s movement across the screen towards the net.

  1. Start Block: Begin with the Green Flag block from the yellow category. This will trigger the programme. [00:52]
  2. Movement Block: Use the Move Right block from the blue category.
  3. Set Distance: To make the ball reach the net, you’ll need to input a number. You can use the grid feature to accurately measure the distance (in the video, the distance is set to 6 to reach the net). [01:40]
  4. End Block: Finish this script with the red End block. [01:06]

Coding the Vertical Movement (Program 2)

This second program must be entirely separate but needs to start at the exact same time. This program will give the ball its arc—up and then down into the net.

  1. Second Start Block: Begin this new script with a second Green Flag block from the yellow category. It is crucial to use a second start block so both scripts run concurrently. [01:17]
  2. Up Movement: Use the Move Up block from the blue category. Set the number for how high you want the ball to arc (e.g., 5). [02:14]
  3. Down Movement: Immediately follow this with the Move Down block from the blue category. Set the distance for how far the ball should drop (e.g., 6). [02:14]
  4. End Block: Finish this second script with a red End block. [01:33]

Running Dual Programs

Now, when you press the Green Flag, the basketball is running both sets of ScratchJr blocks simultaneously. It moves right and goes up and down at the same time, creating a realistic, arcing shot straight into the net! [02:37]

This technique is essential when creating complex animations where you need a character to change more than one property (like position, size, or appearance) at once.

For more coding activities, be sure to check out our collection of structured lessons. You can also find more easy-to-follow video tutorials on our site. Happy coding!