Program block introduction

6 block types:

1、Boot block:It is to start each script, they have a rounded top and a raised bottom, you can only place blocks under them.

2、Execution block:Is the module that executes the commands, they have a notch at the top and a bump at the bottom that can be placed above and below them.

3、Type C block:These blocks are also referred to as "packets" that can be looped through their internal programs or check if the condition is true.

4、Logic block:Is a conditional statement, they are not true or false, it is like asking your friend: "2+2=4?" They will tell you "yes" or "no".

5、Report block:Values, they are rounded and the report block can hold numbers and strings. For example, ask a friend, "What is 2+2?" They will answer "4". It can not only answer the equation, it can also reply to a variable, such as "What is your age?" They may answer: "15."

6、Stop block:It's the block that ends the script, they have a grooved top and a flat bottom, so you can't place any blocks under them.


8 basic Scratch blocks

1、Motion

Features Screenshots Description
mobile Motion Let the character move a certain distance on the stage. The bigger the value, the farther it moves.
mobile Motion Move the character to the corresponding position
mobile Motion Let the character slide to the corresponding position within the specified time
mobile Motion Easily set motion trajectories by changing x and y coordinates
mobile Motion Move to the object location
mobile Motion When the character is in motion, it will bounce if it hits the edge of the stage, and the character movement is on the stage.
direction Motion Rotation angle
direction Motion Specify role orientation, combined with move instructions to move the character in the specified direction
direction Motion Set the role face toward the object

2、Exterior

Features Screenshots Description
speak Exterior Let the character speak, there is time limit to limit the length of time, no time to say
speak Exterior Let the character think, if there is time limit, it will limit the duration, and if there is no time, think about it
Exterior Exterior Let the character show or hide
modeling Exterior Characters can have many shapes, and shape switching allows the character to make many different actions.
modeling Exterior Combine loops and wait for use, let the characters move smoothly
Special effects Exterior Add visual effects to the character
background Exterior A program can have a lot of backgrounds, and the roles are in different scenes by switching backgrounds.

3、Sound

Features Screenshots Description
Play/stop sound Sound Play/stop background sounds and character sound effects
Sound effect Sound Add sound effects
volume Sound Set the volume

4、Event

Features Screenshots Description
occur Event Start directly, click on the green flag to start the code below
occur Event Start the following code when a specific button is pressed. The default is the space bar. You can also use the other buttons in the drop-down menu to control the program.
occur Event Click on the character in the stage and the following program will run.
occur Event When the stage background is switched to the background, the following procedure is executed.
broadcast Event When the sound or timer is greater than the specified value, execute the following program
broadcast Event When the program runs to the broadcast module, it will simultaneously execute a new program starting with "when received"
broadcast Event When the program runs to broadcast and waits for the module, it will execute a new program starting with "when received". After the new program runs, it can execute the broadcast and wait for the program behind the module.

5、Control

Features Screenshots Description
wait Control Wait for the corresponding time to continue the following program, or continue the above program corresponding time
wait Control The execution condition is in the diamond block. When the condition is met, the following program is executed, otherwise it waits
cycle Control The execution condition is in the diamond block. When the condition is met, the following program is executed, otherwise the internal program is repeatedly executed.
cycle Control Execute the internal program the corresponding number of times, then jump out and execute the following program
cycle Control Repeated execution of internal procedures
judgment Control In the diamond block, the internal program is executed when the condition is met, and then the following program is executed. If the condition is not satisfied, the following program is executed.
judgment Control In the diamond block, the internal program is executed when the condition is satisfied, and the internal program is executed when the condition is not satisfied.
termination Control Stop all: stop all programs; stop the current script: stop the current sequence; stop other scripts for the role: stop all programs except the current program column
clone Control Clone the current role or other roles
clone Control Delete all clones
clone Control Control the clone to execute the following program

6、Detection

Features Screenshots Description
ask Detection Can be used in conjunction with
condition Detection 侦测 Events detected between programs
condition Detection Reflect the xy coordinates of a character
Timer Detection Timing function

7、Operator

Features Screenshots Description
Operator Operator Implement addition, subtraction, multiplication and division
Comparison Operator Achieve comparative size
And or Operator Logic or module: When one of the diamond modules satisfies the condition, the program executes, and when it is not established, the program does not execute;
And or Operator Logic and module: The program is executed only when the conditions in the diamond module are met, otherwise it is not executed;
And or Operator Not a module: when the condition is not met, the program executes, otherwise it is not executed.
random number Operator Randomly take an integer in the specified range, including the number of ends
connection Operator Connect two quantities
Detection Operator Detects the value of a specified position character in a quantity
Detection Operator Detect the length value of a quantity
Judge Operator Determine if a quantity contains another quantity
evaluate Operator Find the remainder of the value division
evaluate Operator Round the decimal part of the value
evaluate Operator Taking the absolute value of the value, rounding down, rounding up, square root

8、Variable

Features Screenshots Description
definition Variable Create variable
definition Variable Define the variable name and determine the creation variable
data Variable Variable assignment
data Variable Add one value to the variable
data Variable Call variable value
Show/hide Variable Show or hide variables on the Stage
definition Variable Create an array
definition Variable Define the array name and make sure to create an array
data Variable Add a quantity to the array
data Variable Delete the first item in the array
data Variable Insert a quantity into the specified position in the array
data Variable Replace the specified item in the array with an amount
data Variable Get the value of the specified item in the array
data Variable Determine the position of a quantity in the array
data Variable Get the length value of the array
data Variable Determine if the specified amount is included in the array
data Variable Show or hide an array on the Stage
data Variable Add or remove items from the array on the Stage