Teaching Kids to Program

Teaching Kids to Program
Lesson Plan: Shark Attack
Let’s play Shark Attack!
Step 1:
1. Open your web browser and go to SCRATCH (http://scratch.mit.edu/ )
2. Sign in to your Scratch account by clicking on the
of your screen.
3. Click on the “Create” button
button on the top right hand corner
to start a new project.
Step 2:
Type the name of your
project in the box.
Name your project.
Step 3:
Delete the cat sprite:
We can do the following to delete the cat sprite:
1. Click on the scissors
then click on the cat sprite.
OR
2. Right click on the cat sprite and select the delete option.
Step 4:
Add a stage/backdrop to your game.
To add a backdrop, click on the stage:
For our game we will use
an underwater backdrop
from the library.
There are four ways to add a backdrop to your program:
1. Library: Choose a backdrop from the backdrop library by clicking on the library button :
2. Paint: Draw your own backdrop in the paint editor by clicking on the paint button :
3. Computer: Upload an image from your computer by clicking on the computer button :
4. Camera: Take a picture (if you have a webcam) by clicking on the camera button :
Page 1 of 6
Let’s play Shark Attack!
Step 5:
For our game we will use
sprites from the library.
We will now add our shark sprite
and our fish sprite
to our game.
There are four ways to add sprites to your program:
1. Library: Choose a sprite from the sprite library by clicking on the library button :
2. Paint: Draw your own sprite in the paint editor by clicking on the paint button :
3. Computer: Upload an image from your computer by clicking on the computer button :
4. Camera: Take a picture (if you have a webcam) by clicking on the camera button :
To shrink our sprites, we can click on
then click on the sprite if needed.
Step 6:
Click on any sprite then click on the “Scripts” tab
animate the sprite selected.
to add blocks to
We need to keep a score of how many times the shark
eats the fish
To do this, we will create a counter “Score” which will increase each time the shark “eats” the fish.
To create the counter we will do the following:
1. Click on any sprite.
2. Click on the
3. Click on the
palette.
button.
4. When the following screen pops up, we will name our variable “Score”
Type “Score” in
the box.
Page 2 of 6
Let’s play Shark Attack!
Let us create the script for the shark
We need to tell the shark when to start moving.
We will use the following block from the
palette:
to do so.
We need to position the shark when we start the game, we will use the following block from the
palette:
Type the values highlighted in orange above in the
blocks.
We need to tell the shark how to move:
We would like the shark to follow the mouse pointer, we use the following blocks from the
palette to do so:
This instruction tells the shark
that if it is on the edge of the
screen to bounce away from it.
Putting our blocks together, Our script for the shark is:
We are using this instruction from
the
palette to keep the
shark moving forever until we decide
to end the game.
Page 3 of 6
Let’s play Shark Attack!
Let us create the script for the fish
We need to tell the fish when to start moving.
We will use the following block from the
palette:
to do so.
We need to reset the Score every time we start a new game by selecting from the
palette, the
block.
We need to show our fish and position it on the screen when the game starts by using the following
blocks from the
and
palettes:
Type the values highlighted in orange above in the blocks selected.
We will use the following blocks from the
palette to tell our fish how to move:
This instruction tells the fish that if it is on the
edge of the screen to bounce away from it.
We would like our fish to move around until the shark “eats” it.
To do so we will use from the
palette, the
palette, the
block to get:
Page 4 of 6
block and from the
Let’s play Shark Attack!
We need to increase our “Score” and hide our fish by using the following blocks from the
and
palette:
Connecting our blocks, the script for the fish is :
We can duplicate the fish so that the shark will have a few to eat by right clicking on the fish and
selecting duplicate :
When duplicating the fish, we need to change the values highlighted in the
and the
blocks to any value of our choice so that our fishes will be all over the screen!
Page 5 of 6
Let’s play Shark Attack!
Step 7:
Save your project.
To save your project, click on the
button on the top right hand corner of your screen.
Other options:


You can share your project with the community by clicking on the
button on the top right
hand corner of your screen.
You can also view your project page as it will be seen by the community. You can do this by clicking
on the
button on the top right hand corner of your screen.
Step 8:
Explore!
You can try the following:
1. Make the fish swim faster.
2. Add sound effects.
Page 6 of 6