SCRATCH
APP – BALLOONS
EVERYWHERE
DESCRIPTION
In this program,
you will create an application that will generate balloons randomly on the
screen. This will involve learning how
to create clones (copies) of sprites.
We will also make use of coding on the stage.
STEPS
STEP 0 – NEW APPLICATION
- You need to start with a new
application. So choose File >
New. Of course, you need to save
any previous work beforehand or it will be lost.
STEP 1 – PICK THE BALLOON SPRITE
- Add a new sprite and choose the
balloon.
STEP 2 – SELECT THE STAGE
- At the bottom right, select the
stage (by clicking on “Stage”).
Notice that no sprite is selected anymore. So now, if you add code, you are
adding code to the stage, not to a sprite.
STEP 3 – GENERATE A BALLOON EVERY
SECOND
- Add the forever control. (Control)
- Inside, wait 1 second. (Control)
- Then, still inside, create a
clone of balloon. (Control)
- Place all of the above inside a
Green Flag clicked event block (Event).
STEP 4 – TEST YOUR PROGRAM (NOTHING
HAPPENS)
- Test your program.
Nothing happens because all of the copies of the balloon are at
the exact same place. So you don’t
see them.
STEP 5 – CODE INSIDE BALLOON
- Click on your balloon sprite to select it (at the
bottom).
- You should see an empty coding section.
- Add the event When I start as a clone which is
strangely located in Control.
- Under the event, add the block go to (random
position) in Motion.
STEP 6 – TEST YOUR PROGRAM
- A new balloon should appear every
second.
STEP 7 – CUSTOMIZE YOUR PROGRAM
- You can now customize this. A few ideas:
- Speed up the rate at which
balloons are generated.
- Use glide to make the balloons
move around.
- Resize the balloons so they all
have a different random size.
- Make the balloons appear at the
bottom and glide towards the top to seem like they are helium balloons
being released.
- Use change color effect to
change the colours of the balloons.
- By using a random value, you
can make each balloon be a different colour.
Here
is an example that students came up with in class:
Note: We delete the clone at the end to make sure there
aren’t too many balloons for Scratch to deal with as this can cause a crash.
|