Posted on

Scratch Coding – Rain Catcher

We need to fill our bucket up with rain water. Your program should move the bucket from left to right to catch the falling rain. Once the bucket is full and the player takes it to the bowl they get a point. But the player has to empty the glass if it touches the bird poo.

Sprites

We need to create two sprites: Bird poo and the dark cloud.

Making the Bucket Move

We need our bucket to move from left to right, so on our bucket sprite we can add the following blocks to test if the arrow keys have been pressed.

Moving to the left means we need to subtract values from the axis.

Make it Rain

On our rain sprite, we want to make sure it is hidden when the game first starts. Then every second we will make a new clone of a rain drop fall down.

When the rain drop starts as a clone it will first go to the cloud and then keep moving down on the Y axis until it touches the edge.

Make the Cloud Move

Since our rain will fall from the cloud, we need to make sure that the cloud keeps moving in the sky. To do this we will pick a random location on the X axis and only move once per second.

On our cloud sprite:

Make our Bird Move

We want to have our bird move smoothly across the screen for a random number of seconds. After it gets to its position it should broadcast a message that we can listen to on the bird poo sprite.

On our parrot sprite:

Make the Bird Poo

Now on our bird poo sprite, we want to listen for the bird poo message that is being sent via the bird.

We use the same type of code as before where we hide the sprite first and then show it once it is created as a clone. We make the falling speed a little faster to make it harder for players.

Add a Score

On our bucket sprite we need to add a few more tests. First we need to make sure the score returns to zero.

Change the bucket when water is caught.

On our bucket sprite, we must test to see if the bucket touches the water. When it touches the water we switch the costume to our full looking one. When we touch the bowl and our costume is number 1 (the full glass), then we give the player a score.

If we touch the bird poo, return the costume back to its empty position.