0% found this document useful (0 votes)
114 views

Lesson2 Learningto Run

This Scratch lesson teaches students to animate a cat sprite walking around the screen using programming blocks. The student will create a walking animation using a forever loop to switch between two costumes and move the sprite forward. They will also add wall sprites around the edge of the stage and use if/then blocks to check if the cat sprite is touching a wall and make it turn in the appropriate direction.

Uploaded by

api-216647884
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
114 views

Lesson2 Learningto Run

This Scratch lesson teaches students to animate a cat sprite walking around the screen using programming blocks. The student will create a walking animation using a forever loop to switch between two costumes and move the sprite forward. They will also add wall sprites around the edge of the stage and use if/then blocks to check if the cat sprite is touching a wall and make it turn in the appropriate direction.

Uploaded by

api-216647884
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Scratch Lesson 2. Learning to walk before you run.

In this second lesson we are going to learn how to make the cat sprite walk
through animation and programming. Just like the first lesson where you
animated the cat and made it walk using the keyboard in this lesson you will
animate the cat but use programming to make it walk around the screen.

Blocks to use

Instructions
1. Open up a new project from the
file menu.
Save your file straight away in
your personal folder.
Call the file WalkingCat

2. Click on the control icon to select


the control block pallete.

3. Drag and drop a when clicked


block to the script area.
4. Click on the Motion icon to select
the motion blocks pallete.

5. Drag and drop a go to x: y: block


and connect it to the when
clicked control.
Set the coordinates to the
bottom left of the stage.
Click on the
to test and
adjust the coordinates if you
need to.
6. We now have to get the cat
pointing in the right direction.
Go to the motion block pallete
and drag a point in direction
block onto your script.
Click on the white box to select
the drop down menu then select
RIGHT.

Page 1 of 6

Scratch Lesson 2. Learning to walk before you run.


7. We now have to animate the cat
so that it looks like it is walking
and we use a LOOP to do this.
This means the programme will
keep going round in a loop until
you tell it to stop.
For this we use the FOREVER
loop.
Go to control and drag the
forever loop onto your script.
8. We now have to add blocks
inside the forever loop to
animate the cat.
First we need to get it to move
by adding a motion block
move 10 steps and putting it
inside the forever loop.
9. To animate the cat we now have
to change how it looks by
changing its costume.
If you click on the Costumes tab
you will see the cat has two
costumes.
10.Click back on the scripts tab and
click on the looks icon.
From the block pallete drag the
block into the forever
loop.
11.We now have to use a timer so
that the animation works over a
period of time.
From the controls block pallete
drag the wait control into the
forever loop and set the time to
0.1 seconds.
12.In order to complete the
animation we have to switch
back to the original costume.
To do this we add another move
10 steps block, a next costume
block and a wait block.
Your forever loop should now
look like the script on the left.
Now click on the
Page 2 of 6

to test your

Scratch Lesson 2. Learning to walk before you run.


programme.
Try increasing and
decreasing the number of
steps to see what happens to
your programme.
You may have noticed that the cat
walks straight off the stage and
disappears. To fix this we have to add
some new sprites and then add some
code blocks to your programme.
13.First we have to create our own
sprites.
Click on the paint new sprite
button and a paint editor window
will appear.

14.In the paint editor select the


line tool.
Change the brush size to the
third largest brush.
Select a dark colour of your
choice.
Draw a line along the top of
the stage.
Click OK and a new sprite will
appear in the sprite list.
15.You will now have to adjust the
sprite by right clicking on it in
the stage area and selecting
resize.
Click and drag
the arrows
to make the sprite the full size
of the stage.
Move it up to the top of the
stage.
It doesnt matter if it is too big
as the parts of the screen will
be hidden.

Page 3 of 6

Scratch Lesson 2. Learning to walk before you run.


16.Right click on the sprite in the
sprite list and select duplicate.
Do this two more times until
you have 4 sprites.
Move one of the sprites to the
bottom of the screen.
17.Right click on one of the
remaining sprites in the stage
and select rotate this sprite.
Click and drag the
until
the sprite is vertical. Move the
sprite to the left.
Do this with the remaining
sprite and move it to the right.
You should now have a
coloured square around the
stage.
18.To use these sprites you will
have to name them.
Double Click on the top sprite
on the stage.
In the sprite info area, click on
the sprite name and rename it
top.
Rename the other sprites
bottom, right and left.
You should now have a stage that
looks like the image on the left
although your walls may be a
different colour.

We now have to use another forever


loop so that the programme is
always checking to see if the cat is
touching one of the sides.
19.Add a new when clicked
control and a forever loop
below the script for making
the cat walk.
20.Inside the forever loop we
have to check for certain
conditions and if they are true
we will tell the cat to do
something.
To do this we use an IF
statement.
Page 4 of 6

Scratch Lesson 2. Learning to walk before you run.


An if statement asks a
question. If this is happening
then do this.
21.We now add the question to
the if statement and it goes
inside the shaded hexagon
area.
From the sensing block pallete
select The touching
question.
In the drop down box select
the right sprite.
Add another three IF blocks
inside the forever loop and
add a touching question to
each if block.
22.We now have to tell the cat
what to do if it is touching one
of the walls.
To do this we will add a point
in direction block from the
motions pallete and place it
inside the if block.
If the cat is touching the right
wall we want to make it climb
up the wall by pointing up.
From the drop down menu
select up.
Add a point in direction block
to each if statement.
If the cat is touching the top
wall we want it to point left.
If the cat is touching the right
wall we want it to point

down.
If the cat is touching the
bottom wall we want it to
point right.
Your script should now look
like this.

Page 5 of 6

Scratch Lesson 2. Learning to walk before you run.


23.Check that all your script looks
like the image on the left.
If its ok click on the green flag
above the stage to test your
programme.
The cat should walk all the
way around the stage until
you stop it.

In the sprite info panel change


the rotation of the sprite to
see what happens.
Click on the green flag each
time to test your programme.

Page 6 of 6

You might also like