Skip to content

Please update your browser

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

arrow_back Never Ending Game

Transcript

This add-on video will show you how to make your project run forever! In the core project, the receivers hid and never came back. In this add-on, the sprite will show up again after it catches the ball. To make the sprite wait before continuing, from the “control” menu, place a “wait” block after the “hide” block. Then, from the “looks” menu, place a “show” block after the “wait” block.

To make testing the code easier, delete the other receiver sprites so that only the modified sprite shows up.

Click the flag to test the code. When you pass the ball to the receiver sprite, it catches the ball, waits, hides, waits, then reappears. That’s cool, but the costume should switch back to the “Moving” costume when it re-appears. Fix this by adding a “switch costume to Moving” block right before the “show” block.

It might be more fun if the receiver shows up at a random place on the screen rather than in the same place where it received the ball.

To make that happen, from the “motion” menu, place a “go to x y” block above the “show” block. Then, from the “operators” menu, place one“pick random” block in the x section of the “go to” block and another “pick random” in the y section.

Negative 240 is the farthest left x location on the screen, and positive 240 is the farthest right. Place those numbers in the first “pick random” block. Similarly, negative 180 is the lowest y spot on the screen, and 180 is the highest. Place those numbers in the second “pick random” block. Test the code by clicking on the flag. Now, when the receiver catches the ball, it hides, waits a little, and reappears in a random place on the screen. Good. Now, duplicate this sprite so you have multiple receivers. Test your code often! Computer scientists like you test their code often so when something doesn’t work, they have a better idea of what caused it.

Here's the gameplan: Add a “wait” block after the receiver sprite hides. Make the sprite go to a random spot on the screen. Then, make it reappear.

Choose an Add-On
play_circle_filled
Never Ending Game
Make the receivers disappear and regenerate each time you pass to them.
arrow_forward
play_circle_filled
Passing Back
The ball will always bounce back to the starting position.
arrow_forward
play_circle_filled
Power/Receiver Speed
Add realistic variables with sliders that control the speed of the ball and the receiver sprites.
arrow_forward
play_circle_filled
Keep Score
Count how many passes you complete.
arrow_forward
play_circle_filled
Point & Pass
Change the appearance of the ball sprite.
arrow_forward
play_circle_filled
Excitement
Add some dialogue to the receivers.
arrow_forward
arrow_backward Back
Next arrow_forward
Instructions
  1. Watch the introductory video.
  2. Scroll down to see the add-on choices.
  3. Select an add-on and start creating!
  4. Choose another add-on, and continue building.