In this lesson we are going to learn about conditional statements. Conditional statements allow us to test whether different conditions are true or false, and do something depending on the outcome!
In this lesson we will have a balloon and an animal - if the balloon touches the animal the balloon will pop!
To start off choose two sprites and one backdrop!
Make your animal follow the Make your balloon “pop” when it touches your
mouse pointer. first sprite!
Step 2. Make your balloon move!
Using the blocks below, make a script that will make your balloon glide to a random location on the stage continuously.
Hint: Look at the
move to block already on your balloon sprite for help on where to put the
pick random blocks.
The x axis starts at - 240 on the left, and the y axis starts at -180 at the bottom.
Step 3. Add another condition!
Let’s add another conditional statement, but this time on your animal sprite. Add the script below but choose your own condition!
Hint: Look in the sensing blocks to find the different things that Scratch can sense!
See what other things you can get your sprites to do! Here are some ideas if you are stuck:
- On your last script, change the
thinkblock to another action - make your sprite spin or change colour!
- Right click on your balloon sprite and duplicate it so that you have number of different balloons floating around to be popped.
- See if you can add a variable that counts how many balloons have been popped!