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 sprite 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 pretty cool.

But the costume should switch back to the moving costume when it reappears.

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 XY 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 furthest left X location on the screen and positive 240 is the furthest 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 on 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.

Alright, here's the Game Plan.

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
Never Ending Game
Make the receivers disappear and regenerate each time you pass to them.
Passing Back
The ball will always bounce back to the starting position.
Power/Receiver Speed
Add realistic variables with sliders that control the speed of the ball and the receiver sprites.
Keep Score
Count how many passes you complete.
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.