
1. Code (move (10)steps)
functions to give the sprite a step forward movement, for example: (move (5) steps) the number in the middle is 5 then the sprite will move 5 steps. we can change the number according to our wishes to make the sprite move several steps




2. Code turn ↻ ( 15 ) degrees
Function: Rotate the sprite to the right (clockwise)
The angle can be changed (e.g. 90°, 180°).
3. Code turn ↺ (15) degrees
Function: Rotates the sprite to the left (counterclockwise).
Usually used to control the direction of movement.
4. Kode go to (random position)
Function: Moves the sprite directly to a random position.
No animation (moves straight away).
5. Kode go to x: ( ) y: ( )
Function: Moves the sprite to a specific coordinate.
Example: x = left/right
y = up/down
Useful for determining exact position.
6. Kode glide ( ) secs to random position
Function: Moves to a random position with smooth animation (gliding).
Travel time can be set (e.g. 1 second, 2 seconds).
7. Kode glide ( ) secs to x: ( ) y: ( )
Function: Smooth movement to specific coordinates.
More realistic than “go to”.
8.Kode point in direction ( )
Function: Sets the sprite's facing direction.
Example direction: 90 → right
-90 → left
0 → top
180 → down
9.Kode point towards (mouse-pointer)
Function: Directs the sprite to a specific object.
Can be changed to: mouse-pointer
sprite lain
Often used for games (e.g. enemies following the player).
10.Kode change x by ( )
Function: Changes the horizontal position (X axis).
Positive values → to the right
Negative values → to the left
1. Kode set x to (-43)
Function: Sets the horizontal position (X axis) of the sprite to a certain value.
Example: x = 0 → center of screen
negative x → to the left
positive x → to the right
➡️ So the sprite immediately moves to position X = -43.
2. Code change by (10)
Function: Changes the vertical position (Y axis).
Positive value → up
Negative value → down
➡️ Sprite goes up 10 steps.
3. Code set y to (-61)
Function: Sets the vertical position (Y) to a specific value.
➡️ Sprite immediately moves to Y = -61.
4. Kode if on edge, bounce
Function: Makes the sprite bounce when it touches the edge of the screen.
Usually used for:
Automatic moving object ball game
➡️ The sprite doesn't leave the screen, but bounces back.
5. Kode set rotation style (left-right)
Function: Sets how the sprite rotates.
Options: all around → free spin
left-right → only facing left/right
don't rotate → does not rotate
➡️ Suitable for characters to avoid being upside down.
6.Code x position
Function: Displays the current X position value of the sprite.
`Can be used in scripts (e.g. for conditions).
7. Code and position
Function: Displays the current Y position value of the sprite.
8. Code direction
Function: Displays the direction the sprite is facing (in degrees).
Example: 90 → right
-90 → left
0 → top
180 → down

1. Kode say “Hello!” for 2 seconds
- The sprite displays a speech bubble for 2 seconds.
2. I said “Hello!”
- Sprites speak indefinitely (until replaced).
3. Kode think “Hmm…” for 2 seconds
- Displays a thought balloon for 2 seconds.
4. Think code “Hmm…”
- Displays thought balloons indefinitely.
5. Kode switch costume to (costume2)
- Change the sprite costume to a specific costume.
- Suitable for character animation.
6. Next costume code
- Change to the next costume in sequence.
- Usually used for walking animation.
7. Kode switch backdrop to (backdrop1)
- Change the background.
8. Kode next backdrop
- Change to the next background.
9. Kode change size by (10)
- Change the size of the sprite (enlarge if positive, reduce if negative).
10. Kode set size to (100%)
- Sets the sprite size to a specific value (default 100%).
11. Kode change color effect by (25)
- Gradually change the sprite color effect.
12. Kode set color effect to (0)
- Sets the color effect to a specific value (color reset).
13. Kode clear graphic effects
- Removes all effects (color, ghost, etc).
14. Code show
- Shows the sprite (if previously hidden).
15. Code hide
- Hiding sprites.
16. Kode go to front layer
- Brings the sprite to the front layer.
17. Kode go forward (1) layers
- Advances the sprite one layer forward.
18. Kode costume number / name
- Displays the current costume number or name.
19. Kode backdrop number / name
- Displays the current background number or name.
20. Code size
- Displays the current sprite size.

1. play sound (Meow) until done
- Play the sound until it's finished.
- The program will wait for the sound to finish before continuing to the next block.
🔊 2. start sound (Meow)
- Play sound without waiting for it to finish.
- The program immediately continues to the next block (the sound continues running).
🔊 3. stop all sounds
- Stops all currently playing sounds.
🎵 4. change pitch effect by (10)
- Change the pitch of your voice.
- Mark:
- Positive → higher voice (shrill)
- Negative → lower (heavy) voice
🎵 5. set pitch effect to (100)
- Sets the pitch to a specific value.
- Can be used for special sound effects.
🎵 6. clear sound effects
- Removes all sound effects (pitch, etc).
- Returns sound to normal.
🔉 7. change volume by (-10)
- Change the sound volume.
- Mark:
- Positive → louder
- Negative → slower
🔉 8. set volume to (100%)
- Sets the volume to a specific value (0–100%).
- 100% = maximum.
🔉 9. volume
- Displays the current volume value.
- Can be used for conditions or monitoring.

1. when green flag clicked
- The program runs when the green flag is clicked .
- Usually used to start a program/game .
2. when (space) key pressed
- The program runs when a specific keyboard key is pressed.
- Can be replaced with other keys (arrows, letters, etc.).
- Example: for character control.
3. when this sprite clicked
- The program runs when the sprite is clicked.
- Suitable for buttons or interactive objects.
4. when backdrop switches to (backdrop1)
- The program runs when the background changes to a certain one.
- Used to set the storyline or level.
5. when (loudness) > 10
- The program runs when the sound (microphone) exceeds a certain value.
- Can be used for:
- Clap
- Sound for game control
6. when I receive (message1)
- The program runs when it receives a message (broadcast).
- Used for communication between sprites.
7. broadcast (message1)
- Sends a message to all sprites.
- Don't wait for a response.
- Usually to give orders.
8. broadcast (message1) and wait
- Send the message and wait until all the scripts are finished.
- Used for neat program sequence.

1. Kode wait (1) seconds
- Function: Gives a time delay before executing the next block.
- Example: wait 1 second then continue.
2. Code repeat (10)
- Function: Repeats the command in it a certain number of times.
- Example: repeat 10 → run 10 times.
3. Code forever
- Function: Repeats a command endlessly (forever).
-
Usually used for:
- Continuous movement
- Continuous condition check
4. If (condition) then code
- Function: Executes a command only if the condition is true .
- If wrong → not executed.
5. Code if (condition) then else
-
Function:
- If condition is true → run if part
- If wrong → run the else section
- Used for branching.
6. Kode when I receive (message1)
- The program runs when it receives a message (broadcast).
- Used for communication between sprites.
7. Kode broadcast (message1)
- Sends a message to all sprites.
- Don't wait for a response.
- Usually to give orders.
8. Kode broadcast (message1) and wait
- Send the message and wait until all the scripts are finished.
- Used for neat program sequence.
1. touching (touching …?)
- Checks whether a sprite is touching a specific object (e.g. mouse-pointer or another sprite).
- The result: true or false.
2. touching color (touching color…?)
- Checks if a sprite touches a certain color.
- Useful for area detection (e.g. ground, walls, etc.).
3. color … is touching …
- Checks whether a certain color in a sprite touches another color.
- Usually for more specific interactions between objects.
4. distance to (distance to …)
- Measures the distance of a sprite to an object (e.g. mouse-pointer or another sprite).
- The result is a number (distance).
5. ask [question] and wait
- Asking questions to users and waiting for answers.
- Contoh: “What’s your name?”
6. answer (answer)
- Saves the answer from the “ask” block.
- Can be used for further logic.
7. key (tombol) pressed?
- Checks whether a specific keyboard key is pressed.
- Example: space to jump.
8. mouse down?
- Checks if the mouse is being clicked.
- Result: true or false.
9. mouse x
- Shows the horizontal (X) position of the mouse on the screen.
10. mouse y
- Shows the vertical (Y) position of the mouse on the screen.
11. set drag mode (at mode set)
- Sets whether the sprite can be dragged with the mouse or not.
12. loudness (loudness of sound)
- Measure sound level from microphone.
- Can be used for sound-based games.
13. timer
- Counts the time since the program started or since it was reset.
14. reset timer
- Resets the timer to 0.
15. backdrop # of Stage
- Shows the currently active backdrop number.
16. current (current time)
- Retrieves current time data (year, month, date, etc.).
17. days since 2000
- Counting the number of days since the year 2000.
18. username
Gets the username of the Scratch account currently in use.Basic Mathematical Operations
-
( + ) addition
- Adding two numbers.
-
( - ) reduction
- Subtract the first number from the second number.
-
( × ) multiplication
- Multiplying two numbers.
-
( ÷ ) division
- Divide the first number by the second number.
🎲 Random Operations & Comparison
-
pick random (acak)
- Generates a random number between two values.
-
( > ) more than
- Checks whether the left value is greater than the right.
-
( < ) less than
- Checks whether the left value is smaller than the right.
-
( = ) equals to
- Checks whether two values are equal.
🔘 Logic (Boolean)
-
and (and)
- True if both conditions are true.
- or (or)
- True if one of the conditions is true.
- not (not)
- Reverse values (true to false, false to true).
🔤 Text Operations (String)
- join
- Combine two texts.
- Example: “apple” + “banana” → “applebanana”
- letter (th letter) of
- Take a specific letter from a word.
- length of (length)
- Counts the number of characters in a text.
- contains (contains?)
- Checks whether text contains certain letters/words.
🔢 Advanced Number Operations
- mod (remainder)
- Produces the remainder of the division.
- Example: 7 mod 3 = 1
- round (rounding)
- Rounding numbers to the nearest whole number.
- abs of (absolute value)
- Change the number to positive.
- Example: -5 → 5







Tidak ada komentar:
Posting Komentar