Scratch Custom Blocks and Variables

Post date: Sep 25, 2017 8:29:27 PM

Learning Objective

Know the meanings of the following vocabulary words:

      • Sequence

      • User

      • Developer

      • Script

    • Understand that order matters in a sequence

    • Review the xy coordinate system

    • Demonstrate an understanding of the xy coordinate system by choosing coordinates for a sprite to go to or move steps

    • Create Custom Blocks and define them

    • Create Speed and define it.

Custom Blocks: Custom blocks are a tool used to save time and space. Sequences of code that are multiple lines can be combined into one block to save time when they are used multiple times. They can also allow you to save space on your lines of code. All you need to do is click More Blocks and Make a Block. After you name it, you will be given a Define Control that will allow you to Define what your new blocks will do. Data: Just as you were able to create a score variable. We can create a speed variable. Click Make a Variable and name it Speed. Right Click the speed number and change it to a slider. Now you can add a variable such as speed, that changes, to your script.Directions: Create four Custom Blocks for each direction you want Scratch Cat to move. Name them Move Left, Move Right, Move Up, and Move Down. Use those blocks with the "when the key is pressed" events. The blocks that change the costume, change the direction Scratch Cat points to and move 10 steps under the define sections. When you create your Speed variable, use that as the variable for the movement.