Scratcatch Programming
Scratcatch Programming
in Scratch
Term2
2016-17
Grade 8
Goals
Learn about
event handling
simple sequential execution
loops
variables
conditionals
parallel execution
message passing
Game Description
We will make a
game where the
player controls a
baby using the
arrow keys to
catch a falling ball.
If the baby misses
the ball the game
is over.
Start up Scratch
Click on Scratch.exe
Delete the Cat
Click on the
scissors and your
cursor turns to
scissors and then
click on the cat to
delete it
Or right click on
the cat and pick
delete
Add the Baby
Click on the button with the picture
of folder with a star in it
if you hover over it, it says "Choose new
sprite from file"
Select the People Folder
Scroll to the Baby
Click on the baby and then OK
Resize Your Sprite!
You can make your sprite larger or
smaller by using the grow sprite or
shrink sprite icons.
You click on one of these icons, then
click on your sprite until it is the size
youd like. shrink
grow
Move the Sprite
Select (click on the arrow and then
on the sprite) and click and drag the
sprite to the bottom of the window
Add a Background
Click on the Stage
In the bottom right
area
Click on the
Backgrounds tab
In the center
Click on the import
button
Pick a background
Like bedroom1 in
indoors
Event Handling
We want to control the baby using the
arrow keys
When we click the left arrow the baby should
move left
When we click the right arrow the baby should
move right
This is a form of event handling
Responding to user actions like mouse clicks
and key presses
The Scratch Stage
The Scratch stage is 480 pixels wide and
360 pixels high. 180
Moving left decreases the x value Moving right increases the x value
-180
Programming the Baby
Click on the baby
sprite in the view of
the sprites and stage
Bottom right section
Click on the Scripts
tab This area shows the
current sprite
In the center area
This allows us to create
scripts (programs) for
the baby
Each sprite can have
several scripts
Respond to Arrow Keys
Click on Control (orange) and then
drag out "when space key pressed"
Respond to Right Arrow
Click on down arrow next to
space and select right arrow
Click on Motion (blue) and
drag out "move 10 steps"
Change the move amount
Click on the 10
it will highlight in blue
Type 5 and press enter
Respond to Arrow Keys
Click on Control (orange)
Drag out "when space key
pressed"
Change "space" to "left
arrow"
Click on Motion
Drag out "move 10 steps"
Change it to -5 (to move left)
Click on the stage and try out
the left and right arrow keys
Does the sprite leave the
window?
Paint a Ball
Click on the paint brush and star
It will say "Paint new sprite" if you
hover over it
Draw the Ball
Circle tool and eyedropper
Click the circle tool
and then use the
eyedropper to pick a
color
and then click in the
drawing area and
Drawing area
drag to create the
Click ok when
ball done
Size the ball as desired
and move it to the top
Click and drag the ball to the top of
the window
Make the Ball Fall
When the green flag is clicked we
want the ball to always start at the
top and fall down
Click on Control (orange)
Drag out "When green flag clicked"
Start the Ball
Click on Motion (blue)
Drag out go to x # y #
this will always start the ball at its current
position (Scratch doesnt automatically put it
back for you).
Sequential Execution
One block is executed
after the other
In order from top to
bottom
When the green flag
is clicked
the ball will go to the
specified x and y
location
Loops
We want the ball to continue to move
down unless the baby catches it
How do we make this happen?
We could use lots of blocks one after the
other
But, that would be slow and repetitive
We need a way to repeat a block or
set of blocks
This is called a loop or iteration
Make the ball fall
Click on Control
(orange)
drag out "forever"
Click on Motion (blue)
drag out change y by
10
Change it to -1
Try it out!
Catch the ball!