Scratch Projects, Feb 29, 2012, Cardinal Forest Elementary School
Go to Assignment part 2 for this lab, after finishing this part:
- Draw a spiral of squares shapes: press 's'
Steps to build this program:
-
Create a variable:
Type in a name for this variable, use "sidelength":
Drag out a "set sidelength" block
- We're writing a program to draw these variable length squares:
- Create a broadcast message inside a repeat block. Name the message "drawSquare":
- Create blocks to receive this broadcast message to draw a square:
- Use the variable "sideLength" in the drawSquare program block:
- In the broadcasting block, you want to change the sidelength by 5 each time you draw the square. This is a variable:
- Activate this script of blocks when an 's' is pressed on the keyboard:
Notice how the variable of the variable "sidelength" has changed. Why?
- Create blocks to clear the screen. Send a broadcast message "clearScreen":
- Here's the entire program of blocks:
- Go To Assignment for this lab.