Skip to content

Kidsblock Programming

1. Scratch Animation Programming

1.1 Scratch Animation and Common Programming Function

image-20230530115530622

1.2 Move The Sprite

Drag image-20230530115700911 from image-20230530115721500 to the script editing area, and then drag the block image-20230530115852700 from image-20230530115908574 to put it under the green flag image-20230530120011359.

Click image-20230530115700911, and the Sprite will move 10 steps to the right.

If you change 10 into more steps, will the little Sprite move farther?

Or, if it is changed to a negative number, will the Sprite go back in an opposite direction?

image-20230530120420164

1.3 Emit Sound

Drag image-20230530120624915 from image-20230530120723827 and stick it under image-20230530115852700, and then click the green flag to execute these code blocks.

Img

You will hear that the little ladybug is calling. If not, please check whether your speaker is muted.

image-20230530120601388

Click image-20230530121025654 under the left conner to choose an extension:

image-20230530121140474

In this way, more options of music are provided! Please have a try!

1.4 Dance with the Beat

Back to image-20230530115908574, we add another image-20230530115852700, and set the steps to “-10”.

In image-20230530131149251, pull image-20230530131319346into script and select drums.

Click the green flag, the small insect will move back and forth with the beat.

image-20230530131544240

1.5 Repeat an Execution

In image-20230530131618613, find image-20230530131645316and pull it under the block image-20230530115700911. The "repeat" block will half-surround all the code blocks we have set.

Click the green flag, and the insect will repeat the previous movement.

image-20230530131946738

1.6 Speak

In image-20230530132033640, drag a "say" block: image-20230530132138049.

Paste the "say" block under image-20230530115700911, and click the green flag.

image-20230530132336681

1.7 Green Flag

Block image-20230530115700911 in image-20230530115721500 should put on the first place of a complete code. Therefore, when you click the green flag, its following code will be executed; while the red button is clicked, execution stops.

Green Flag

Img

Why should we click here rather than the one on the block?

Because when there are many comic characters, you have to click this green flag if you want to make them move altogether. Otherwise, you can only run each character code individually!

1.8 Change Color

In image-20230530132033640, find image-20230530133107155 and drag it to the editing area.

Click to execute, and you will see the color changed.

image-20230530133232907

1.9 Key Control

In image-20230530115721500, drag a image-20230530133336256 above last block we have put. According to the block, press the corresponding key on your keyboard, do you see the color changed?

image-20230530133822951

Tap the little triangle, a drop-down menu will show up. Then you can choose a key as you like to change the color of that ladybug!

image-20230530133839991

1.10 Add a Backdrop

Click image-20230530134130174 to select a backdrop from the library:

image-20230530134249705

Choose a backdrop as you like and click it to set.

image-20230530134458872

Now the stage become colorful!

image-20230530134608556

1.11 Create a Sprite

Various Sprites are integrated in Scratch, and we construct code blocks to move them at will.

Here are four methods to create a new Sprite:

  1. Choose one from Scratch Sprite library
  2. Draw one by yourself
  3. Add an image file
  4. Take a photo

image-20230530135234001

Let's try Method 1: Click
image-20230530135347823 to select one from the library.

Here we choose Amon:
image-20230530135430242 and Amon will show up on the stage!

Img

Copy the code block among Sprites:

Each Sprite enjoys its own code, which can be copied to others. For how? Just directly drag the script program to the Sprite that you want to be copied:

image-20230530140026931

1.12 Record

In
image-20230530120723827 find
image-20230530120624915.

Click the triangle to select "record...". After recording, it will be automatically displayed in the menu.

image-20230530140239799

1.13 Switch Costume

Multiple costumes for every Sprite can be found in image-20230530140523384:

image-20230530140428946

Dynamic effect: Add a
image-20230530140742187 in "forever" block as below, and when you execute them, a dynamic effect will be presented! It is so interesting, isn't it?

image-20230530141019855

1.14 Add a Condition

Construct the following code blocks, and answer it "11" and other numbers, do you see the difference?

7d91ade66f0e26f792f2de6fb4902de2

Now it is an interactive game! Moreover, you can set rules of the game by yourself, which can cultivate you logic thinking. And you are a game developer now!

1.15 Block (Function)

Before all, let's take a look at this song and find out some rules according to different colors.

Img

The same rhythm is in the same color, so we can set the same part as a module block. When using, we can call the block directly to save time.

Programming:

In
image-20230530142609232 find
image-20230530142625856 and make three blocks respectively name them part 1, part 2 and part 3. Among them, compose notes as followings, and we add some beats and instruments.

Click the green flag, music starts to play!

Of course you can compose a music and set its playing speed at will! Hope you enjoy the joy of creating!

Img

1.16 Variable

A variable is a piece of data that can change. It originates from mathematics and it is an abstract concept in computer language that can store calculation results or represent values.

For instance, a teacher counts the total score of each student's Chinese, Mathematics and English test, in which the calculation method is the same (scores of the three subjects are added together), but the names of students and their respective scores are different. In this example, the score and total score are variables.

Based on this example, we write a program to calculate the total score:

In
image-20230530143705762 , click
image-20230530143726558 to make five variables: name, aggregate score, English score, Teaching score and verbal score.

Find
image-20230530143912592 and
image-20230530144006081 in
image-20230530143920414 , and connect them as shown below. After execution, click the green flag, and the total score with names will be automatically calculated and output.

Img

1.17 Coordinate of the Stage

A step equals a coordinate value.

Taking the center of the stage as the reference point 0, it is divided into different parts for movement! Do remember that when designing the program later!

Img Img

1.18 A Magician

Write a program as shown below.

Click any position on the stage, and it will show a magical effect. Please analyze and familiarize with the logic of the program and the functions of each block by yourself, and try to re-construct it for different effect!

Img