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

JuanPablo-ProgrammingActivities

This document introduces the basics of programming using Scratch 3.0, explaining algorithms and coding processes. It provides step-by-step instructions for creating projects, including loading sprites, using command blocks, and implementing sound effects. The document also includes challenges and examples for users to practice their coding skills.

Uploaded by

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

JuanPablo-ProgrammingActivities

This document introduces the basics of programming using Scratch 3.0, explaining algorithms and coding processes. It provides step-by-step instructions for creating projects, including loading sprites, using command blocks, and implementing sound effects. The document also includes challenges and examples for users to practice their coding skills.

Uploaded by

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

CHAPTER 1

There are procedures to do something efficiently. This procedure is called an


algorithm. To apply an algorithm to a computer, it must be expressed in instructions
that the computer can understand. To solve a given problem, we need to write an
algorithm and code it in a language that the computer can understand
(programming language). In the coding process, we look at the problem through
debugging, and when all problems are solved, let the computer execute the
command. All these processes are called programming activities.
In this chapter, we will do block coding using scratches that are made easy for
students to use.

1. Introduction to Scratch 3.0

-3-
-4-
① Scratch can be executed on your computer using the tools provided online or by
downloading.
② Here, we will do programming directly online.
- https://scratch.mit.edu/
- https://scratch.mit.edu/download (Download the Scratch App)

③ To use Scratch, sign up and log in to save your code in the cloud and share it with your
students. You do not necessarily have to sign up to use Scratch.

Tutorials
When you access Scratch and click Create, a screen to code scratch appears and you can see
Tutorials as shown below. If you are new, we recommend that you watch the tutorial video.
If you want to see more tutorials, click Tutorials on the menu.

-5-
-6-
Cute here 

Let's summarize the process of loading the sprite like the above.

Click on the cat and delete (click on the trash)

Click on + and choose a sprite (you need to find the sprite you want or charge an object)

-7-
① In the menu at the top of the screen, there are language setting, file, edit, and tutorials.

-
- File : save or load the created program on your computer.
- Edit : Turn on/off Turbo Mode to accelerate the program. It is mainly used for testing the code
created.
- Tutorials : You can try various examples to learn scratch.

-8-
② On the left, there are tabs for Code, Costumes, and Sounds. There is a Blocks Palette where
you can see command blocks.

- On the Code tab there are blocks of command that the computer will execute. At the bottom
of the Code tab is Add Extension, which can be used by adding command blocks.

-9-
characters of the theater stand. It's also
where you can see the completed program running.
⑤ In the Sprite list section at the bottom right of the screen, this is where you can load the
sprites to be used or the list of loaded sprites displayed.

⑥ On the right side of the Sprite list is where you can set the background.

- 10 -
2

When programming (coding), click the block and then drag and drop to move.

- 11 -
3

To run the created program, Click the flag in the picture. However, using blocks like the one
shown in the figure, you can press the space key on the keyboard to execute it, or you can make
it to run when you click the sprite with the mouse and
receive a specific message. Depending on the program
you have created, you can run the program differently.

Generally is used a lot.


If you want to forcibly stop the executed program, click
.

Sprite list at the bottom of the Stage shows various


information of Sprite. For example, in the figure below,
the sprite currently selected with the mouse is named Sprite1, and the sprite is at the position
of x coordinate –3 and y coordinate 5. You can set the exact position by entering a number
directly into this coordinate. The X and Y coordinate values are based on the center of the
sprite.
The X coordinate is in the range of -240 to +240. The Y coordinate is in the range of -180 to +180.
Size is where you set the size of the sprite. It means 100% of the original image size. Direction
indicates the direction of the sprite moves when there is move command as well.
Show is a function that hides or shows the sprite on the screen.

- 12 -
Let's make it move.
Let's change the shape of the sprite to express the live movement everytime when it moves up
and down by 5,
As it moves up and down, there is no need to change the shape of the sprite from side to side or
flip it.
When it touches the upper or lower walls, the direction of movement will be reversed to so it
can keep moving up and down.

- 13 -
Cut here 

Let's summarize how to create a sound effect suitable for sprites.

- 14 -
Click on Sounds

Find the sound to use with the sprite.

use the block "start sound _" or "start sound _ until done”.

put the block where you need to start. Usually later the flag.

See my project on https://scratch.mit.edu/projects/855218071

- 15 -
04 Challenge

Let's solve the problem.

Mission!
Global warming makes it difficult for polar
bears to live.
Let's program a campaign to save the polar
bears.

See my project on
https://scratch.mit.edu/projects/85523
9456

- 16 -
See my project on https://scratch.mit.edu/projects/855243794

- 17 -
Let's make your own story.
(How about making a program of introducing yourself and showing it to a friend?)

_________________________________________________________
1. Set the background. I choose and upload a rural school.
_________________________________________________________
2. Delete the sprite and find a new sprite, I choose a people and change
_________________________________________________________
the head for my head.
_________________________________________________________
3. In the program. I use the block “when the flag clicked”. “go to x_ and y”
and block “not rotate”
_________________________________________________________
4. Inside the control block “Forever” I program the movement changing
_________________________________________________________
the costume, sound effect to the steps and walk for 10 steps but when
it touches edge turn back.
_________________________________________________________
5. While the sprite is walking in other block you have to use the block
_________________________________________________________
“when the flag is clicked” to generate the conversation to introducing
yourself
_________________________________________________________

_________________________________________________________

2. Expressing the movement of an object

- 18 -
02 Experience

Moving the sprite

- 19 -
① Bring a cat sprite.

Click on the flag of Scratch to run the program you created.

Move the sprite by 10 in the direction.

Experience programming activities


Try moving the sprite by 100 from left to right on the screen.
There are various ways to do it, but the most basic way is to move 10 times by 10 as shown in
the block below. Using 10 of the same block is inefficient, but you should experience the
inconvenience to understand why you need to code more effectively.

- 20 -
See my Project on https://scratch.mit.edu/projects/855251725

Cut here 

- 21 -
Let's write the ways to make the butterfly move like the image above.

See my project on https://scratch.mit.edu/projects/855253301

Delete the sprite and choose a butterfly.

Use the block “When flag clicked”.

Then, use the loop “forever” because the butterfly all time is moving.

With the purple block “Switch custom to” and choose different custom to make
butterfly move

In my case I use the block “wait _ second” to see butterfly move better.

03 Application

1 Creating sprites
① Delete the cat in the sprite window.
② Let's make a background. Select [Choose a Backdrop] in [Stage].
③ Select forest from various backgrounds.

- 22 -
④ Bring the sprite over the background. [Choose a Sprite] ⑤ Select Unicorn Running Sprite.
⑥ Select Ladybug2 Sprite.

- 23 -
When you click on the flag, the program code for the
Unicron Running sprite starts.
The first thing to do is to reduce the unicorn sprite to
an appropriate size because it is too large. Here it is
reduced to 50% of the size.
Each time the unicorn moves by 10, the shape of the
unicorn changes.
If you repeat this forever, the unicorn continues to
move. When the unicorn touches the wall, if you
change it to the opposite direction, it will continue to
move left and right.

Ladybug2

When you click the flag, the program code for


Ladybug2 Sprite starts.
Since the size of Ladybug2 is too big, it has been
reduced to about 75%.
Ladybug2 will move up and down, so set the point in direction to 180 degrees.
To make Ladybug2 move slowly, make it move up and down by 5.
Let's change the shape of Ladybug2 when it moves up and down by 5 to express the
movement.
As it moves up and down, there is no need to change the shape of the sprite from side to side
or flip it.

- 24 -
See my Project on https://scratch.mit.edu/projects/846353811

- 25 -
See my project on https://scratch.mit.edu/projects/855314127

Cut here  Let's write the

algorithm make it like the image above.

- 26 -
Use block “When flag clicked”.

“Set size to 75%” to change the shark size.

Use the loop “For ever”.

With the block “Move 10 steps “.

“Next costume” to see the move.

“Set rotation style (left-right)”

“If on edge, bounce”

Let's solve the problem.

Mission!
Let's fire the rocket.
The sun is passing,
the moon is passing and sometimes
the comet is passing too.

See my project on
https://scratch.mit.edu/projects
/855318188

- 27 -
See my project on https://scratch.mit.edu/projects/855335996

Let's make your own story.


(What story can you make using basketball?)

_________________________________________________________
1. Change the background to Basketball.
_________________________________________________________
2. Delete the cat and add Andie, and basketball ball.
_________________________________________________________
3. Program Andie: Set the position on x and set the move when you press
_________________________________________________________
right arrow and left arrow.
_________________________________________________________
4. When you press space bar, Andie must change the custom
_________________________________________________________
for see the move to throw the ball.
_________________________________________________________
5. I put on the background a red shape for finish the game
_________________________________________________________
when the ball touch the basket.
_________________________________________________________
_________________________________________________________

- 28 -
3. Jump with keyboard

- 29 -
See my Project on https://scratch.mit.edu/projects/846895559

- 30 -
Keyboard recognition ① Load a bat sprite.
② Move the bat sprite to the left or right using the left and right arrow keys on the keyboard.

③ Use the following command blocks.

- 31 -
This block does what it needs to do each time you
press the keyboard while the scratch program is
running.

This is a block that repeats the command blocks infinitely.

programming activities
The sprite's movement is controlled via the keyboard. Let's create a program that recognizes
the keyboard and allows you to do different things for each key on keyboard.

- 32 -
See my Project on https://scratch.mit.edu/projects/855345855

- 33 -
See my project on https://scratch.mit.edu/projects/855348964

Cut here 

Let's write the order of how the mouse escapes the maze.

- 34 -
Set the background to maze. You need upload from internet.

Delete the cat and choose a mouse.

Mouse: you must program the move, to up with the up arrow, down with the
down arrow, right with the right arrow and left with the left arrow

When the flag is clicked “for ever” next custom to see move the mouse

I add a green shape when the mouse has exit the game stop and say, “You WIN”
using “when the mouse touch the green colour”.

1 Create a sprite
① Delete the cat in the sprite window.
② Let's make a background. Select [Choose a Backdrop] in [Stage].
③ Select Woods from various backgrounds.

④ Load the sprite over the background. [Choose a Sprite] ⑤ Select a Lion sprite.
⑥ Select a Wizard-toad sprite.

- 35 -
- 36 -
Lion

Click the flag to position the Lion sprite at the


coordinates of x:150 and y:-100.
Because the Lion's size is too big for the screen, it's
reduced to about 60%.
Make the Lion walk from side to side. When it
touches the wall, the moving direction changes to
the opposite direction, so it can keep moving.
This can be done by adding Forever to execute
repetitive commands. Since it's walking too fast,
you can change it to 0.1 second so that it moves a
little slowly.

The wizard-toad should be coded to be hidden on


the screen when the game is over. Therefore, the
next time you run it again, the Wizard-toad is not
shown. To prevent this mistake, use the show block
on the screen when you first click the flag. Its size
should be 50%, and the position is x:-150 and y:-
150. To indicate the number of times Wizard-toad
jumps, a variable called my variable is used, and its
value at the beginning will be set as 0.
Using the forever block, you should continuously check if Wizard-toad and Lion sprites
collide into each other. If it collides with Lion, Wizard-toad disappears and the program
ends.

- 37 -
If you press the right arrow key on the keyboard while the program is running, it moves to x:0,
y:0 for 1 second, and then moves to x:150, y:150 for 1 second.
Each time the arrow key is clicked on My variable, 1 is added. That is, the number of jumps
increases by one.
Set the point in direction to -90 degrees so that it faces the opposite direction after jumping.
The left arrow key has the same algorithm, so the code is the same as well.

- 38 -
See my project on https://scratch.mit.edu/projects/855354673

Cut here 

Let's write the algorithm that the car can move like the above.

- 39 -
Change the background, I find it on internet.

Delete the cat and choose another sprite. I find it on internet.

To program the car, you have set the start position, and the different keys: to up with the up
arrow, down with the down arrow, right with the right arrow and left with the left arrow.

Remember to program the point in direction depend of arrow pressed.

Let's solve the following problem.

Mission!
Use the keyboard to get jewelry and
fruit on the right screen.

See my project on
https://scratch.mit.edu/projects/85
5359527

- 40 -
Let's make your own story.

See my project on https://scratch.mit.edu/projects/855364255


(How about controlling a flying hot air balloon using the keyboard?)

_________________________________________________________
1. Set the background.

_________________________________________________________
3. Choose the sprite: air balloon.

_________________________________________________________
2. To program the air balloon. First set the size and whit the block
“Forever” next custom with “wait 0.2 seconds”.
_________________________________________________________
4. to up with the up arrow, down with the down arrow, right with the right
_________________________________________________________
arrow and left with the left arrow.
_________________________________________________________

_________________________________________________________

_________________________________________________________

_________________________________________________________
_________________________________________________________

- 41 -
4. Pop the balloon with the mouse

- 42 -
See my project on https://scratch.mit.edu/projects/847342400

Sprite's recognition of mouse


① Load a Ghost Sprite,
② Make the image changes when the mouse pointer touches the Ghost sprite, and make it
moves when the mouse is clicked.

③ Use the following command block.

- 43 -
Conditional block determines if the
mouse pointer hits a Ghost sprite. The
code when the mouse pointer is touched
and the code when it is not touched are
treated as a if statement block.

This is a block where you can write the


code that needs to be done when the
sprite is clicked with the mouse.

Programming activities
You should understand how to determine whether the mouse pointer touches the sprite or it is
clicked. Coding should be done in a way to do different things according to mouse events.

- 44 -
- 45 -
See my Project on https://scratch.mit.edu/projects/855603446

See my Project on https://scratch.mit.edu/projects/855629118

- 46 -
Select background “Park”.

Upload the sprites for the garbage. Set each in a random position.

Upload the sprite for the trash. Set a start position.

With the block “When this sprite clicked” and for ever to move and go to the trash
and then hide.

1 Create a sprite
① Delete the cat in the sprite window.
② Let's make a background. Select [Choose a Backdrop] in [Stage].
③ Select Colorful City from various backgrounds.
④ Select Night City to use 2 backgrounds by adding a background.

- 47 -
⑤ Add the sprite over the background. [Choose a Sprite] ⑥ Select Balloon1 sprite.

Balloon

- 48 -
When you click the flag, the Balloon sprite will be
placed in a random position, so when you start, you
don't know where it will appear.
If the direction of movement is rotated about 15
degrees, it will move in the direction that is inclined
about 15 degrees. Set my variable to 0 using a variable
block called my variable. my variable is the number of
times the balloon being popped by click. Add a variable
to create a Speed variable block. At Speed variable, set
the speed of the balloon when it first starts. In this case,
it is set as 5. Through the forever repeat block, it moves
at the speed set by you. Set the balloon not to be rotated
when it hits the wall.
In Balloon Sprite, you also need to program the action
when the mouse is clicked. Therefore, the code below
should be added.

The 'when this sprite clicked' block is


for when the sprite is clicked with
the mouse.
Once the balloon has been clicked,
add 1 to the my variable to increase
the number of times the balloon
was clicked (popped).
It would be better if there is a
sound effect when the mouse is
clicked. Here, we use a sound file
called Pop.
When you click the mouse, the
balloon disappears from the screen.
Use the next Costume block so that
the balloon of other images
appears next time. For better effect when clicked, make the background to be changed each
time the balloon is popped.
After one balloon disappears from the screen, another balloon reappears at a random
position after 1 second. The movement speed of the new balloon should be set to 3 to 10, so
that the speed is different each time new balloon appears.

- 49 -
See my project on https://scratch.mit.edu/projects/847342400

- 50 -
See my project on https://scratch.mit.edu/projects/855653111

Cut here 

Let's write the algorithm that the robot recognizes the position of the mouse and moves as
above.

- 51 -
Set the background and choose the sprite. In my case an egg.

Swich custome and set the random position.

In the block “Forever” I use the block “gide 0.1 secs to mouse-pointer”.

If touching edge switch custome to broke the egg and finish the game.

Let's solve the following problem.

Mission!
Let's create a program that follows the
mouse so that the diver can swim away
from the shark.

- 52 -
See my project on
https://scratch.mit.edu/projects/8
55670126

Let's make your own story.


(What about imagination of stars being created wherever you click the mouse?)

See my project on https://scratch.mit.edu/projects/855679636

_________________________________________________________

- 53 -
_________________________________________________________
1. Set the background to space.
_________________________________________________________
2. Add the sprite to star. And set the random start position.
_________________________________________________________
3. On the star: “when this sprite clicked” create clone of myself.
_________________________________________________________
4. I use a variable to count the numbers of stars clicked.
_________________________________________________________

_________________________________________________________

_________________________________________________________

_________________________________________________________

_________________________________________________________

5. The ball falls from the sky

- 54 -
① Load Pico Walking and Donut Sprites.
② Move the Pico Walking sprite to the right. At this time, make it move until it hits the Donut,
and the program ends when it hits the Donut.

③ Use the following command blocks.

- 55 -
This block moves the sprite's position to x:-120, y:-38. It
is used to send the sprite to a specific location.

The repeat until block repeats the code until a given


condition is achived.

Block that determines collision with Donut using touching


Donut.

If the above two blocks are used as shown, the program is


repeated until it hits the Donut.

Programming activities
The sprite's movement is controlled by the keyboard. Let's create a program that recognizes
the keyboard and allows you to do different things for each keyboard.

- 56 -
- 57 -

See my project on https://scratch.mit.edu/projects/855696246

- 58 -
Upload a background from internet. And upload a Squirrel.

First set the move of the mine.

To program the Squirrel to jump when press the space bar.

When press the arrow key the squirrel must move.

Using the block “If” touching the mine next custome to show the explosion and use
the sound effect and finish the program.

1 Create a sprite
① Delete the cat in the sprite window.
② Let's make a background. Select [Choose a Backdrop] in [Stage].
③ Select Woods from various backgrounds.

④ Load the sprite over the background. [Choose a Sprite] ⑤ Select giga sprite.
⑥ Select parrot and tennisball sprites.

- 59 -
- 60 -
Clicking the flag reduces the giga sprite to 40% size.
Use the if-then block to determine if the giga sprite and
the Tennis Ball sprite collide with each other.
If there was collision, it adds 1 to the variable score.
For the collision effect, Make the size of the giga to be
80, and restore its otiginal size after 1 second to
continue the game.
When the game repeats after the giga returns to its
original size after the collision, the x coordinate of the
giga will be randomly changed to move to a random
position.
The forever block is a block that continuously repeats
this process.
The parrot flies from side to side at the top of the
screen and try to drop the Tennins Ball sprite to the
ground.
When the flag is clicked, the coordinates are placed
at x:0, y:120 and the size is reduced to 50%.
In order to make it move only from side to side, the
point in direction is set to 90 degrees.
If on edge, bounce block is used to make it move in
the opposite direction when it hits the left or right
walls of the screen, and set the rotation style is set to
left-right so that the image can face to the opposite
direction when moving in the opposite direction.
Since the parrot's image when flying seems
too fast, we will set 0.1 second wait to slightly reduce the speed.

Tennis Ball

When you click the flag, the Tennis Ball sprite is not in a fixed position. As the parrot is
trying to drop the tennis ball to the ground, the tennis ball must always follow the parrot.
It is also recommended that the Tennis Ball is hidden from the screen using hide block.

- 61 -
When you click the space key on your keyboard,
then the Tennis Ball will appear on the screen and fall
down.
Change size by –10 is to make the game more
difficult by making the tennis ball smaller each
time you press the space key.
It is set to turn on the sound effect by pressing
the space key. Here, we will use the pop sound.
Tennis Ball did not use a move block. Falling
down to the ground means that the y value in the
coordinates decreases, so we use change y by -
10. In this case, the y-coordinate decreases
indefinitely, so we coded that it can follow the
parrot again when it hits the bottom edge, using
repeat untill.

- 62 -
See my Project on https://scratch.mit.edu/projects/847478075

not

See my project on https://scratch.mit.edu/projects/855767515

Cut here 

How can a helicopter determine the risk of collision? Let's write the algorithm.

- 63 -
Set the start position and size.

I generate the move with 15


grades to right and left.

With the block “If” touching colour


to identify the collision with the blue
colour because the building is blue

Other way to identify the collision


was with the block “Touching” and
select the number of the building
sprite.

Let's solve the following problem.

Mission!
Let's create a baseball scenario.
Make the ball fly when the pitcher's
ball hits the batter's bat,
or make the ball stop when it hits the
catcher's glove.

See my project on
https://scratch.mit.edu/projects/8
47902460

- 64 -
Let's make your own story.
(Do you know the Ping Pong game? It is a game that sending a ball left or right.)

See my project on https://scratch.mit.edu/projects/855785864

_________________________________________________________

_________________________________________________________
Set the size and start
position.
_________________________________________________________

_________________________________________________________
With block “Forever” and
_________________________________________________________
with conditional “If” I
_________________________________________________________
program the move of the
ball with touch the border
_________________________________________________________
and the racket.

_________________________________________________________

_________________________________________________________

_________________________________________________________

6. Create a block breaking game

- 65 -
See my Project on https://scratch.mit.edu/projects/847499396

- 66 -
Duplicate Sprite
① Use the basic Cat sprite.
② Click the Cat Sprite to duplicate. Let's make several cat sprites.
③ The sprites have the same shape, but the code of sprite should be automatically duplicated.
④ Make the x-coordinates of all sprites different in order to confirm that each duplicated sprite
works differently.

⑤ Use the following command blocks.

- 67 -
This block assigns values to variables.
Let's assign a value of -150 to the variable named
Cat_x.

Add sprites by duplicating. This duplicated sprite is


called clone, and when cloned, it duplicates the code
of the original sprite as well.

A block that adds code so that you can perform certain


commands when a clone is created. It runs every time
a clone is created.

This deletes all clones created.

Programming activities
Cloning a sprite does not mean simply copying and pasting. Sprites created by cloning can
execute different code. Let's see the difference.
Clicking on a sprite will duplicate the sprite. When you make a duplicate, they all overlap in
the same location. So, whenever a clone is created, change the x-coordinate value to the
right.

- 68 -
- 69 -
See my Project on https://scratch.mit.edu/projects/855800029

See my project on https://scratch.mit.edu/projects/855803691

Cut here 

- 70 -
Let's write how to create a pyramid shape with the number of blocks reducing as it get
stacked.

I use the block “when this sprite is clicked” to make


a clone of myself.
I created three variables to count the number of
clones, and the position on x and y.

With the conditional block “If” I program the form


of the pyramid.

1 Create a sprite
① Delete the cat in the sprite window.
② Let's make a background. Select [Choose a Backdrop] in [Stage].
③ Select Underwater1 from various backgrounds.

- 71 -
④ Load the sprite over the background. [Choose a Sprite]
⑤ Select Jellyfish and Pufferfish sprites to be used as blocks in the block breaking game.
⑥ Baseball and Paddle sprites are also
selected.

We haven't coded to the background in previous


sections, but it is possible even though it is
limited. The way to code the background is the
same as for sprites. However, there are
commands that cannot be used in the
background, such as move. Here, we use the
sound
of a bubbles as a background sound.

- 72 -
Paddle

The paddle is a sprite that catches a flying ball. Therefore, you must move it left or right using
the left and right arrow keys. Let's change the x-coordinate value instead of using the move
command.
It is set that paddle stops moving when the paddle reaches the left or right end in order to
prevent the paddle from disappearing on the screen.

Baseball

- 73 -
Baseball plays the role of breaking
blocks in a block breaking game. Also,
when it touches the top, left, and right
edges, or the paddle, the direction of
movement must be changed, and if it
falls to the bottom, the game must end.
So, it takes a lot of process to determine
what it touches. We set the size and
initial coordinates and set the direction
of movement to 135 degrees. We add
forever block to make the ball keep
moving and keep checking for
collisions.
The first collision decision is whether it
touched the paddle. When it hits the
paddle, the direction of movement
changes randomly with the sound
effect.
Also, when it hits the top,
bottom, left, and right edges, it
bounces, so check the y-coordinate
value of baseball to end the game when
it reaches the bottom of the screen. If it
reaches a position smaller than y:-170, the game ends as if it is considered to fall to the bottom
of the screen.

- 74 -
The important thing about Jellyfish is that Jellyfish is arranged to be full on the screen.
Repeat the create clone of myself block 10 times to create 10 Jellyfish clones. Create and use
the variable x1 to assign the x-coordinate value to each clone. After creating one clone,
increase the x1 value to 45, so that each Jellyfis clone is arranged at 45 pixel intervals.
The reason to show before creating a clone and hide at the end is to create a clone and use the
clone instead of the original.
The sound used is Magic Spell to give a sound effect when colliding with Baseball. When
colliding with Baseball, Jellyfish disappears.
To emphasize the screen effect, set the image of Jellyfish be changed continuously.

- 75 -
This sprite has the same role as
Jellyfish. So the code is the same.
However, it is not recommended to
be in the same position as Jellyfish,
set the y coordinates differently.
Repeat the create clone of myself
block 10 times to create 10
Pufferfish clones. Each clone uses
variable x2 to assign x-coordinate
value. After creating one clone, we
increase the value of x2 to 45, so
that each Pufferfish clone is
arranged at 45 pixel intervals.
The reason to show
before creating a clone and hide at
the end is to create a clone and use
the clone instead of the original.
The sound used is Magic Spell to
give a sound effect when colliding
with
Baseball. Pufferfish will disappear
when colliding with Baseball.
To emphasize the screen effect, we set the image of the Pufferfish to be changed continuously.

See my Project on https://scratch.mit.edu/projects/847499396

- 76 -
See my Project on https://scratch.mit.edu/projects/855823434

Cut here 

Can you make an algorithm to represent the solar system? Let's wirte the algorithm.

- 77 -
Choose a background to space.

Choose the sprites to use, in my case I chose three,


the sun, the earth and another planet.

The sun: Set the size and the start position in the
middle.

For the planets: to simulate the move around the


sun, I use “Repeat” 365 and move with turn 1
grades to generate the circle moving.

Let's solve the following problem.

Mission!
At the fruit store, we need display
strawberries beautifully using
math.
Which method should we use to get the
right shape?

See my project on
https://scratch.mit.edu/projects/855
953481

- 78 -
Let's make your own story.
(Do you know the Whack-A-Mole game? Let's make a game that hit a mole sticking out its head
suddenly.)

See my project on https://scratch.mit.edu/projects/855983433

_________________________________________________________
Each of mole must be back of the hole and be on
start position.
_________________________________________________________

_________________________________________________________

_________________________________________________________
____________________________________ _____________________
With the block “Forever” glide to generate the move
_________________________________________________________
to hide behind the hole
_________________________________________________________

_________________________________________________________
With the block “If” touching the Magic Wand start
sound and hide
_________________________________________________________

_________________________________________________________

- 79 -
7. sin and cos functions are dancing

- 80 -
Send and receive messages between scratch sprites
① Pitcher, Batter and Baseball sprites are used.
② When the Pitcher Sprite sends a message to the Batter saying "I'm throwing the ball", the
Batter sends a message saying that it is ready.
③ The pitcher throws the ball and the baseball sprite moves.
④ It is a method to create a program so that sprites operating differently can cooperate
through messages.

⑤ Use the following command blocks.

This is a block to send and receive signals


between sprites (a block that sends
messages).

When a message is broadcast by someone,


the sprite using this block starts the
program (the block that receives the
message).

A block that allows sprites to display text on


the screen with speech bubbles. You can
also specify the duration of the text
displaying on the screen.

This is the block that waits for the operation


to be finished at the receiving block then
continues the next program.

- 81 -
programming activities
Clicking the space key on the keyboard tells the batter that the pitcher is throwing the ball. The
batter receives a pitcher's signal and notifies him that he is ready. The pitcher who received
the signal sent by the batter throws the ball. The pitcher throws the ball and the batter hits
the ball, but the signal can control the order of progress between the two sprites.

- 82 -
Adding broadcast messages

- New message : create a new message.


-Play, read,.... : Select from the message.

- 83 -
See my project on https://scratch.mit.edu/projects/847902460


See my Project on https://scratch.mit.edu/projects/855992346

- 84 -
Let's write the scenario of Cinderella having a conversation.

The prince and Cinderella are dancing.

The clock rings. Cinderella Say: “OMG I have to go”

The prince answer: “Please don’t go” I love dancing with you.

Cinderella runs and forgets her shoe.

1 Create a sprite
① Delete the cat in the sprite window.
② Let's make a background. Select [Choose a Backdrop] in [Stage].
③ Two of the backgrounds, which are Xy-grid and Xy-grid-20px, will be used.

- 85 -
④ Load the sprite over the background. [Choose a Sprite] ⑤ Only a ball sprite will be used.

⑥ In this topic, we will draw with dots or lines.


⑦ Blocks that draw points or lines are used after adding a library block with a pen function.
Click Add extension as shown below to bring up the [Choose an Extension] screen.

- 86 -
- 87 -
⑧ If you select Pen, blocks related to Pen can be added and used as shown in the following.
-erase all: erase all of the pen drawings.
-stamp: duplicate the sprite like a stamp.
-pen down: Start drawing with the pen.
-pen up: Pause drawing with the pen.
-set pen color to: Specify the pen color.
-change pen color by 10: change the color by changing the color value.
-set pen color to 50: Specify the color value.
-change pen size gy 1: Make the thickness of the pen thicker by 1.
-change pen size gy 1: Set the pen thickness to 1.

Xy-grid Xy-grid-20px

No coding was done on the background, but in the process of running the program, the sprite
switches the background. Xy-grid is used as a background for graphing sine functions, and Xy-
grid-20px is used to draw a circle graph moving clockwise using a sine function and a cosine
function.
For reference, the sin function andd cos function can express the rotation angle from 0 to 360
degrees as –1 to +1.
The following is a general graph of sine and cosine functions.

- 88 -
<Source: wikipedia>

Ball

The ball sprite acts as a pen to draw with the Pen block command. The path the ball sprite
moves is the path it draws. Move the ball sprite to draw the desired image. Reduce the size
appropriately before use. Here, we will draw a graph with a size of 15.
When the program starts, use the erase all block to erase all pen drawings that may have
remained on the screen from previous.
The variables x1 and y1 were created and assigned as x1:-240 and y1:0, where x1 and y1 are
the starting points for graphing with the sin function.
If the ball sprite's x-coordinate is greater than 238, it is on the verge of exiting the screen on
the right. This is because the sine function graph does not need to be drawn off the screen.
If the ball's x-coordinate is off the screen, it broadcasts a circle message and goes into standby.

- 89 -
- 90 -
When a circle message occurs, write the code to receive it and change the background to
xy-gird-20px. Then, assign 0 to the x1 and y1 variables, and set the x and y coordinates of
the center point to to 0 and 0.
To draw a circle graph, change the x and y coordinates to sin(x1) and cos(y1). Since the
values generated by the sin and cos functions are -1 and +1, the graph of the circle graph
with this value will be too small. To increase the circle graph, we multiplied the x and y
coordinate values by 150. Then, draw a point on the circle graph and add 2 to x1 and y1 to
set the position of the next point.

- 91 -
If you increase the coordinate value of a point on each circle graph by 2 and make 180
points, a circle graph that rotates 360 degrees is drawn. When the circle graph is
completed with 180 points, set -240, 0 for the variables of x1 and y1 to change to the
position to draw the sine function graph, and finish the circle graph drawing. When the
circle graph drawing is finished, the program related to the circle message is terminated, so
that the sine function graph drawing in the standby state is restarted.

- 92 -
See my Project on https://scratch.mit.edu/projects/848682866

- 93 -
For this Project you have add the extension
“Pen” to drawing on the screen.

You need set the pen position and colour.


Must use two variables to the correct position
while the pen is drawing.

With the blocks “operators” you need to use


the function sin.
When the paint is finished the program must
send a message

When the message is received, change the


background, and start to draw a circle.

Let's solve the following problem.

Mission!
Let's send a spaceship travelling from
Earth to the star. Let's land the
spaceship by avoiding the aliens.

See my project on
https://scratch.mit.edu/projects/85
6005060

- 94 -
Let's make your own story.
(Let's make an alarm clock using the computer's time.)

See my project on
https://scratch.mit.edu/projects/856234688

________________________ _________________________________
Draw a clock and add the pointer. Set in the middle
_________________________________________________________
and with the block “Forever” turn 6 grades to
_________________________________________________________
simulate the move of the clock.

_________________________________________________________

_________________________________________________________

_________________________________________________________
Add other sprite to activate the alarm, in my case I
_________________________________________________________
use a green shape and with the block “If” play the
sound, say “wake up” and stop the game.
_________________________________________________________
_________________________________________________________

_________________________________________________________

8. Create a language translation wizard

- 95 -
Language translation function

- 96 -
① We will use Wizard and Wizard-toad Sprite.
② Wizard will greet you by translating Korean into 4 languages (English, Vietnamese,
Indonesian, Azerbaijani). It's up to you to translate more languages.
③ Wizard-toad is a magic frog. The magic frog speaking in Russian.
④ Since we use the translation service provided on the Internet, we will be able to translate
into more languages in the future.

⑤ Use the following command blocks.

It tells you what language is currently set


for Scratch. If the language setting is set to
English, it shows that it is English.

Translate the text (hello) into the


designated language.
Please check if the language you want to
use is translatable.

After reading the text (hello), it is


converted to sound and output through
the speaker.

You can specify the voice tone that reads


text by converting it to sound (alto, tenor,
squeak, giant, kitten).

programming activities
More features are available using Scratch's library blocks. Extensions will play a bigger role as
Scratch evolves. Here, we will use two of the extension libraries, which read and convert text to
sound, and the language translation function.
We will translate a simple welcome message and read it in your language.

- 97 -
- 98 -
See my Project on https://scratch.mit.edu/projects/849338313

See my project on https://scratch.mit.edu/projects/856409991

- 99 -
Cut here 

Let's write how you can display lyrics in foreign languages with K-POP music and dance.

I use a background with a beautiful


place in Korea.

I use two sprites, a girl listening to music


and a play button.

When you click the play button start a K-


pop song and traduce the first lyrics to
the English and 5 seconds later to the
Korean.

1 Create a sprite
① Delete the cat in the sprite window.
② Let's make a background. Select [Choose a Backdrop] in [Stage].
③ Select Withc House from various backgrounds.

- 100 -
④ Load the sprite over the background. [Choose a Sprite]
⑤ Select the Jamal and Jordyn sprites to talk to each other.

- 101 -
There is no special coding in this background. If you don't like the background, change it to the
desired background.

Create two variables like translate1 and


translate2.
When the flag is clicked, translate1 is set to
English and translate2 is set to Korea.
The voice tone to be output through the
speaker is set to alto and the language is set to
Korean.
When Hello! is displayed on the screen, a sound
(“hello”) translated into Korean is output
through the speaker. If ‘I speak English’ is
displayed on the screen in English, and the
sound translated to Korean (“I speak English.”) is
output.
After the introduction of Jamal, the country will
broadcast. In other words, the order of program
execution is passed to Jordyn. When the
program to be executed by Jordyn Sprite is
completed, Jamal displays 'Enter in English...!'
on the screen and translates an English sentence
into Korean. It will translate the sentence

- 102 -
entered in English into Korean, output it as sound, then broadcast the talk again.

When the program starts, Jordyn is looking at the right side of the screen, so it will be
rotated by -90 degrees to look at the jamal on the left side of the screen.
When Jamal's program progresses and the country is broadcasted, Jordyn outputs the
word 'Hi' in Korean on the screen, then translates 'Hi' in English through the speaker. Next,
‘I speak Korean’ in Korean is displayed on the screen, and ‘I speak Korean’ will be translated
into English output as sound. If the talk is broadcast while Jamal's program is running, it
inputs Korean and translates into English.
As a result, if you enter in Korean, it will be translated into English and read. If you enter in
English, it will be translated into Korean in real time.

- 103 -
Let's use the program that translates the language of the country you want to communicate with
into your own language.
Each Pufferfish clone is arranged at 45 pixel intervals.
The reason to show before creating a clone and hide at the end is to create a clone and use the
clone instead of the orginal.
The sound used is Magic Spell to give a sound effect when colliding with Baseball. Pufferfish will
disappear when colliding with Baseball.
To emphasize the screen effect, we set the image of the Pufferfish to be changed continuously.

See my Project on https://scratch.mit.edu/projects/850235050

- 104 -
See my Project on https://scratch.mit.edu/projects/856548478

Cut here 

Let's write the algorithm for inserting subtitles in order to introduce Korean dramas and movies
to foreign friends.

- 105 -
To add subtitles in the conversation, I use
the block “When the flag” to start a
conversation.
Then I use two news extension, one for
the voice and other for the translation.
I set the translation between the Korean
and English.
Later to answer to the other person I use
the block “When I receive” a message to
generate a response and have a
conversation about an awesome movie
called “Parasites”.

Let's solve the following problem.

Mission!
Korea's agricultural technology is advanced
enough to grow rice in the deserts of the
Middle East.
Let's create a program to transfer
agricultural technology to a country having
starvation.

See my project on
https://scratch.mit.edu/projects/85656
4719

- 106 -
Let's make your own story.
(In Myanmar, it is difficult for foreigners to understand bus routes because these are displayed
only in their own language. What if the language on signs and the bus routes are translated?)

See my project on https://scratch.mit.edu/projects/856598172

_________________________________________________________

I use the map of the Metro system


of my city Medellin. I putted
different points to mark places in
the map.

_________________________________________________________

________________________________________________ _________

_________________________________________________________

_________________________________________________________

- 107 -
_________________________________________________________
I use custome to change the colour of the points.

______________________ ___________________________________

_________________________________________________________
With the extension voice and translate when you
_________________________________________________________
click on the point say the name of the station in
Korea.
_________________________________________________________

- 108 -

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy