Sound effects are a great way to improve a game or story. In this baseball game we'll add in sound effects for hitting the ball and the crowd.
Create a new Scratch project and delete the cat sprite.
Go to the Scratch website using the link below and click on the 'Create' link in the blue bar at the top.
By default, each new project starts with the cat sprite already added. To delete the cat click on the x in the blue circle beside the cat in the sprite list.
Ass the Baseball 2 backdrop from the backdrop library.
To add a backdrop from the backdrop library follow these steps:
You can use search box or the filter links (Fantasy, Music, Sports etc) to locate your backdrop.
Add the Batter sprite from the sprite library and then add the following code to make her swing bat when you press the space bar.
Since your tablet or iPad doesn’t have a physical keyboard, you’ll use on-screen buttons to complete this task. Wherever the instructions in this lesson mention pressing a key, you’ll need to tap a button on the screen instead. So, while your steps are a little different, you’ll still be able to make everything happen in your project.
So for example, instead of doing either of these:
You need to add an on-screen button (like an arrow sprite) and use this code:
Now, just tap the button on the screen to perform the same action!
Add the Baseball sprite from the sprite library and give it the following code to set it up for the start and make it move towards the batter.
To add a sprite from the sprite library follow these steps:
You can use search box or the filter links (Animals, People, Fantasy etc) to locate your sprite.
When the ball touches the bat we will play a hit sound. To detect if the ball touches the bat we will use a touching color ? block and use the colour of the bat.
Add the following code to the Baseball sprite, underneath the change x by 10 block.
Some of the sensing blocks allow you to set a colour to decide what they should do.
You can choose which colour to use by clicking on the colour in the block and either using 'Color', 'Saturation' and 'Brightness' sliders to set the color.
Or you can use the eye dropper tool to choose a colour.