Skip to content

Please update your browser

Your browser version is not supported by this site. CS First may not work properly. Learn more

5. Add More Receivers

Transcript

Now that you have one receiver working, you can copy it to add more receiver sprites to your passing drill. In this video you will create the rest of those receivers. Right click on the receiver sprite in the sprites area, and select duplicate. Do this as many times as you want receivers. It looks a little weird that the receiver sprite catches the ball while the ball keeps moving to the edge of the stage. Fix this by making the ball sprite stop at the receiver just like it does at the edge of the stage.

Click on the ball sprite. From the "operators" menu, drag out an "or" block. Remove the “touching edge” block from the “repeat until” block, and place it inside the first blank of the “or” block.

Then, from the “sensing” menu, place the “touching color” block into the other side of the “or” block. To choose a color, click the color swatch on the block, then with the mouse pointer click a color that all the receiver sprites have on them. Place the “or” block back into the “repeat until” block. The code reads “repeat moving until touching the edge or the color that’s on the receiver sprites.” Test the code by clicking the flag. The ball sprite should go back to its starting location when it touches the edge or a receiver. That’s more realistic. Tinker around with the numbers in your code.

If you think the receivers move too quickly, put a smaller number in the "move" block.

To change the speed at which the ball sprite turns, change the numbers in the "turn" blocks.

Explore, test, and make this passing drill your own!

Here's the game plan: Copy the receiver sprite by right clicking it and choosing “duplicate.” Change the ball sprite's “repeat until” to use “or” and “touching color.” Tinker with the values!

Once you've done all that, move on to the next page to check out some add-ons!

arrow_backward Back
Next arrow_forward
Instructions
  1. Copy the receiver sprite by right clicking it and choosing "duplicate."
  2. Change the "repeat until" using "or" and "touching color."
  3. Tinker with the ball sprite's "move" and "turn" blocks.