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.
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.
Make the receivers disappear and regenerate each time you pass to them.
The ball will always bounce back to the starting position.
Add realistic variables with sliders that control the speed of the ball and the receiver sprites.
Count how many passes you complete.
Sign in to track your progress and earn badges