|
|
Lesson 5
Over the Sea with Fishes
Objectives
At the end of this lesson, you will:
» Make a sprite appear at a point in the stage
» Move sprites in more ways
You will need...
To complete this lesson, you will need a computer with Scratch 2.
Birds and Fishes over the Sea
On the last lesson, we made the scripts of the birds. The birds are now flying
in the sky but the fishes do not have a script yet. If you still have your saved
Scratch program from lesson 4, we can load that. If not, we will change the
white backdrop with a backdrop that’s over the sea. Delete the cat and put
fishes in the water.
The fishes will swim up and down from the water in a semicircle. They can
appear from anywhere in the water to go up. We can change the color of the
fishes every time the fish starts to swim up so that it will look like there are a
lot of fishes swimming up and down. To keep the fishes from swimming for
too long, we can hide the fish after swimming and make the fish wait. We will
only show the fish when the fish is going to swim up.
1. Place a when green flag clicked in the script area. This script is for all
the fishes we put in the stage so we want them to run their script at the
same time.
2. Move forever under when green flag clicked.
3. Move a goto x: _y: —_ block in between forever. This block will make
the sprite go to a point in the stage.
4. Move a show under go to x: _y*
Lesson 5 — Over the Sea with Fishes 25Since we want the fishes to start from anywhere, we will use pick random 1
to 10 for the x and y values of go to x: __ y: _-
5. Place a pick random 1 to 10 in the x value of go to x:_ y:_- Change 1
and 10 for the x value of the leftmost part of the water and the rightmost
part of the water respectively.
Place a pick random 1 to 10 in the y value. Change 1 and 10 for the y
value of the bottommost part of the water and the topmost part of the
water respectively.
>
. Move point in direction 90 found under Motion under go to x: pick
random _ to _ y: pick random __ to _. 90 means that the sprite is
facing at the right. We change it to 0 so the fish can move upwards to
swim up.
N
Our script should look like this:
Po ee
point in direction Gp
The fish will swim up and down from the water in a semicircle. From
facing up, or at 0, we make the fish slowly face down, or at 180, while
moving forward. This is how the fish should move like:
We will make the fish turn 10 degrees 18 times to make 180 degrees
180 degrees means that the fish will be fa in; i
fish move before tuning every time. ate oe
26 Lesson 5 ~ Over the Sea with Fishes8. Move a repeat 10 under point in direction 0. Change 10 to 18
9, Move a Move 10 steps in between repeat 18, We can hange the 10 to
make the fish land farther.
10. Move a turn Clockwise 10 degrees under move 10 steps. This block
will make the fish turn 10 degrees to the
right. Turn counter-clockwise
10 degrees makes the fish turn left.
11. Move a hide under repeat 18 to hide the fish after going down.
12. Move change color effect by 25 under hide.
13. Move a wait 1 secs under change color effect by 25.
Our script should now look like this:
Together with the birds, our stage can look like this after a few seconds
of clicking the green flag!
*tesceccgcooescoens® sesson 5 ~ Over the Sea with Fishes 7in the stage using the go to x:__|
a sprite move in a semicircle by
Exercises
Part I. Match the functions on the right with the blocks on the left.
aoa VP
. Faces the sprite upwards
Moves the sprite to a point in a stage under a number of seconds
A.
RB;
C. Turns the sprite to the right.
D. Picks a number between 1 and 10
E.
Moves the sprite to a point in a stage
Part II. Make all the fishes spiral or spin while swimming up. Making a
sprite turn 360 degrees will make it spin.
TOO Oem es eeeseeseesnsaeere
28 Lesson 5 ~ Over the Sea with Fishes