The forever loop continuously executes the blocks inside it without any built-in stopping condition; it will run indefinitely until the user manually clicks the Stop button. In contrast, the repeat until loop executes its internal blocks repeatedly only until a specified condition becomes true. Once that condition is met, the repeat until loop automatically terminates.
Blocks are the fundamental, puzzle-piece shaped instructions that you give to the computer in Scratch. A script is a complete program or sequence of commands, formed by interlocking multiple blocks together in the coding area. When a script is activated, Scratch runs these connected blocks from top to bottom, executing the instructions in the specified order.
Pen blocks are primarily used to draw shapes and patterns on the stage, allowing the sprite to leave a colored trail as it moves. They also enable changes to the pen’s color, saturation, brightness, and size. In Scratch 3.0, Pen blocks are not in the default palette; they must be added by clicking the “Add Extension” button located at the bottom left corner of the Code tab, and then selecting the “Pen” option.
When you open Scratch, the default sprite is a cat, but you can add new sprites through several options. You can choose from a vast Scratch Library of pre-made sprites, or paint a completely new sprite using the built-in drawing tools. For a quick addition, there’s a “Surprise” option that adds a random sprite, and you can also “Upload Sprite” from image files saved on your computer.
In programming, variables are containers in the computer’s memory used to store data, whose value can change during the execution of a program. Scratch supports two main types of variables: Numeric variables, which store numbers and are used in calculations (e.g., scores or counts), and String variables, which store text, words, or characters and are typically not used for mathematical operations.
To draw a regular polygon, you use the repeat block, setting its value to the number of sides the polygon has. Inside the loop, you typically include a move block to draw one side and a turn block to rotate the sprite at each corner. The crucial calculation for the turn angle is to divide 360 degrees by the number of sides of the polygon, ensuring the sprite completes a full turn around its starting point.
You can change a sprite’s direction using the “Turn” blocks found in the Motion block category. The turn ( ) degrees block rotates the sprite in a clockwise direction, while the turn ( ) degrees block rotates it anti-clockwise. In these blocks, a positive degree value (e.g., 15) indicates a clockwise turn, whereas a negative degree value (e.g., -15) signifies an anti-clockwise turn.
The Scratch user interface includes the Block Menu, which lists categories of programming blocks, and the Script Area (or Coding Area), where users drag and snap these blocks together to form instructions. The Stage Area is where the project’s actions unfold visually, featuring sprites against a chosen backdrop. Additionally, the Sprites Info Pane displays details about selected sprites and backdrops.
The stamp block creates a duplicate image of the sprite on the stage at its current location, essentially leaving a “footprint.” To create patterns, this block is typically placed inside a loop (like repeat or forever), combined with move and turn blocks. As the sprite moves and rotates, the stamp block repeatedly duplicates its image, forming intricate and repeating visual designs on the stage.
The if...then block executes a set of instructions only if a specified condition is true; if the condition is false, the blocks inside its “then” section are skipped, and the script continues with blocks outside of it. In contrast, the if...then...else block provides two paths: it executes one set of instructions if the condition is true, and a different set of instructions within the “else” section if the condition is false. This ensures an outcome regardless of the condition’s truth value.
Scratch is an easy-to-use programming language designed to help users create their own games, animated stories, and interactive art. It allows creations to be shared with others over the Internet, fostering a community of creators. Its block-based interface makes programming accessible by allowing users to drag and combine visual blocks to build projects.
The Motion blocks are blue and control how a sprite moves, such as moving a certain number of steps or turning. Looks blocks, colored purple, manage a sprite’s appearance on the stage, including changing costumes, size, or displaying speech bubbles. Sound blocks, which are pink, are used for audio functions like playing sounds, adding music, or even recording voices for a project.
Logical Operators in Scratch are used to combine the true/false results of two or more relational operations, yielding a single true or false outcome. The “and” operator returns true only if both expressions are true, while the “or” operator returns true if at least one expression is true. The “not” operator reverses the truth value, returning true if the expression is false. They allow for more complex and refined conditional checks within scripts.
Want to print your doc? This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (