Scratch Basics
Scratch Basics
Scratch Basics
2-1
A.M P.M
Sessions 1~3/6 sessions in total Time
O
Material -
34 Chapter 02 Scratch Basics
Unit
01 Scratch UI components
Area tab : 8
2
[Code] Tab: You can code
by dragging the command Code Area: In Scratch,
block from the palette. code means finding
[Costumes] Tab: You can and putting together
edit the costumes to be blocks of instructions
used in sprite. to pass to the
[Sound] Tab: You can edit computer. The space
the sound to be used in where you create these
sprite. codes is called the
1 code area.
CHAPTER
13
5 Stage control window: You can specify
the background of the stage. You can 14
also add the background provided by
Scratch or draw it yourself. 15
4
Unit
CHAPTER
In addition, you will need to [Choose] your date of birth and gender, and an email 01
is required. [Click] ‘Create Your Account’ to complete the registration.
02
You will be automatically connected to the Scratch website while logged in. 03
04
05
1
2
06
❶ If you want to share your project ❷ Now that you have verified your 07
and leave a comment on the mail, let’s go back to the Scratch
Scratch website, you will need 08
website. [Click] the ‘OK, Let’s
to check the verification email go’ button.
sent to the email address you 09
entered when you signed up
as a member. In your mailbox, 10
[Click] the English link in the
email sent by Scratch. 11
12
13
14
15
[Click] ‘Create’ menu at the top left A screen appears where you can
create code (assembled command
blocks) as shown above. The name
of this screen is Editor.
38 Chapter 02 Scratch Basics
CHAPTER
01
02
When Scratch is executed, the The Scratch app (Scratch Offline
following screen is displayed. Editor) is running. Now, you can use 03
[Choose] ‘I agree’ - [Click] ‘Close’ the Scratch app without internet.
04
05
08
10
11
12
13
14
15
[Drag] a block from the Block Palette - [Drop] the block on the Code Area in the
middle. → We will refer to this process as [Drag-and-drop] from now on.
40 Chapter 02 Scratch Basics
❶ [Click] the ‘file name box’ (now, it’s n ‘test’.) - [Enter] the name of the file you
want to replace
❷ [Click] the ‘File’ menu at the top left - [Choose] ‘Save now’
Then, you can check later even if you close the window you are working on or log
out.
account
Unit
01
02
Planning a scratch program
03
Let’s make a program that moves cats and hedgehogs. When the cat approaches the
hedgehog, the cat makes a sound because of the thorns, and the hedgehog and the cat 04
go in different directions. Let’s take a closer look at each movement.
05
Cat Hedgehog
Execution result 06
Costume Code Costume Code
12
A reaction that
Surprised Step back Cowering makes it think 13
Hmm...
14
Walking in 15
Move with
a different Lying down Move seats
keyboard
direction
If you look closely, you can see that the shape of the mouth changes when the cat
touches the hedgehog.
42 Chapter 02 Scratch Basics
01
Whatever you put inside the ‘forever’ block repeats 02
itself forever. There’s no option to join anything at the
bottom, because a ‘forever’ loop never ends. 03
07
➊ [Click] on the Event
block palette 08
2
➋ [Drag-and-drop] a event
09
block ( )
1
10
11
12
13
[Click] on the Control block
14
palette - [Drag-and-drop] a
‘forever’ block 15
44 Chapter 02 Scratch Basics
※ If you drag a block to the code area, a ‘shadow’ (or ‘white box line’ in case of a blank
space in the block) is created where the block can be inserted as shown above. If
you drop a block at this time, the block will be placed at that location.
Block explanation
※ If you drag a block to the code area, a while line is created where the block can be
inserted as shown above. At this time, if you drop it, the block is placed there.
2-1 Understanding and using scratches 45
CHAPTER
01
02
03
[Click] the drop-down menu inside the ‘key~pressed?’ block - [Choose] ‘right 04
arrow’
05
06
07
08
09
10
If a conditional expression is ture, the blocks If the conditional expression is true, the first set
between the ‘if ~ then’ block’s jaws will run. of blocks runs. If not, the second set runs.
2-1 Understanding and using scratches 47
Block explanation
CHAPTER
01
02
03
04
05
[Click] the ‘Costums’ tab in the
upper left corner 06
[Right click] - [Click] ‘duplicate’
07
08
09
10
11
12
13
Right now you can only move left and right. Let’s add some blocks so we can move
up and down. How can I make it move up and down?
Block explanation
Coordinates are used to move a sprite to a particular spot on the
stage. It doesn’t matter how near or far away the spot is. ‘change y
by 10’ block makes sprite’s posirion change y by 10.
When a cat approaches a hedgehog, it “meows” and tries to back away. Let’s use the ‘if
~ then ~ else’ block. In this code, whether the hedgehog is touched or not is treated as
a conditional expression.
Block explanation
CHAPTER
01
02
03
04
[Click] on the Control block palette [Click] on the Sensing block palette 05
- [Drag-and-drop] a ‘if ~ then ~ - [Drag-and-drop] a ‘touching ~ ’
else’ block in the ‘forever’ block block in the ‘if ~ then ~ else’ block 06
07
08
09
10
11
15
❶ [Click] on the Looks block palette - [Drag-and-drop] a
‘switch costume to left’ block in the ‘if ’ block
❷ [Click] on the Motion block palette - [Drag-and-drop] a
1
‘move 10 steps’ block in the ‘if ’ block - [Click] the white
2 window - [Enter] ‘-10’
2-2
A.M P.M
Sessions 4~6/6 sessions in total Time
O
Material -
52 Chapter 02 Scratch Basics
Unit
Let’s make the code we’ve made so far a little more diverse. Let’s make it even more fun
to express the cat’s surprise at the hedgehog’s thorns. You can also add the direction
the cat moves.
3
1
CHAPTER
01
02
03
04
05
06
07
08
09
[Click] the Brush Icon [Click] Fill - [Choose] color and adjust saturation - 10
[Enter] brush thickness size
11
13
14
15
You can freely decorate the sprite as you like. In addition to the ones provided by Scratch,
you can draw and use them yourself.
54 Chapter 02 Scratch Basics
Decorate the sprite with the set [Enter] a name that suits the purpose
brush. according to the shape of the sprite
CHAPTER
epteal
01
02
03
The cat approaches the hedgehog. It touches a hedgehog’s spines, makes a “meow”
sound and changes direction. However, the hedgehog does not respond. Now let’s 04
code the hedgehog to react to the cat.
05
07
[Click] on the Looks
block palette
08
[Drag-and-drop] a
‘switch costume to ~’ 09
block in the upper jaws
of the ‘if ~ then ~ else’ 10
block
11
12
13
14
15
56 Chapter 02 Scratch Basics
[Click] the hedgehog sprite - [Click] the Costume tab - [Choose] the 4th
appearance that changes when it comes into contact with the cat among various
costumes
TIP Broadcasting
One type of broadcast block lets a sprite send a message. The other tells the sprite to
receive a message. Choose an existing message or create a new one.
CHAPTER
01
[Drag-and-drop] a ‘think ~ for ~
[Click] on the Looks block palette seconds’ block - [Click] first blank 02
[Drag-and-drop] a ‘switch costume - [Enter] ‘Hmm...’ - [Click] second
03
to ~’ block (hedgehog-d) blank number ‘2’
04
05
06
07
08
[Drag-and-drop] a ‘switch costume [Click] on the Motion block palette - 09
to ~’ block (hedgehog-a) [Drag-and-drop] a ‘go to random
position’ block 10
11
[Click] the Run Icon ( )
12
13
14
15
The hedgehog also reacted and completed the code to run away to a random location.
58 Chapter 02 Scratch Basics
CHAPTER
01
02
03
04
[Click] the File menu. - [Click] ‘Save [Click] the arrow on the right( )
to your computer’ - [Click] ‘Open Folder’ 05
06
11
12
Unit
Can you create a project based on what you have learned so far?
Now, create your own mini game project. If you can’t come up with an idea, you can
think about it while copying the following.
Setting up a Storyline
The ball will fall from the top random
location. If you catch the ball in the
bowl, your score goes up by one point.
If the ball does not fit into the bowl
and touches the red line, the ball
disappears.
If so, let’s prepare the necessary
sprites and stage backdrops.
CHAPTER
01
[Click] on the ‘Ball’ sprite If you want to resize the sprite,
[Enter] a number in the ‘Size’ field. 02
[Click] on the ‘Bowl’ sprite too
The size of the bowl is 150.
03
04
05
06
07
08
09
[Click] ‘Choose a backdrop’ [Click] to select the appropriate
background 10
11
02
03
04
1
05
2
06
07
You have already learned to code to ❶ [Select] the variable ‘my valuable’
control a sprite with the keyboard from the ‘Valuables’ block palette 08
arrow keys. Let’s complete the code ❷ [Right click] - [Click] ‘Rename
09
that moves the bowl from side to variable’ (Change variable name
side. to ‘score’) 10
11
12
13
14
15
The Bowl sprite has a score variable, and each time the Ball sprite sends a message,
the score is incremented by 1. And, if you look at the code, you can see that the
score starts again from 0 when the game starts.
64 Chapter 02 Scratch Basics
End the game when the score reaches Just as the score always starts with 0
10. At this time, the backdrop is when the game starts, the backdrop
also changed. always makes the start screen.
2-2 Storytelling project made with Scratch 65
CHAPTER
01
One of the advantages of Scratch is to share the project I made with my friends who
are learning with me. Sharing projects allows us to exchange feedback and improve the 02
quality of coding. And, you can get ideas for the next project. So this time, I’ll learn
how to share my project. 03
05
06
07
08
09
10
[Click] the Share button (orange square) on the Create Project screen 11
12
There is also a way to share it in my stuff.
13
14
15
Alternatively, there is also a way to copy the address window link directly from the
Create screen and share it with others.