Coding with Scratch
scratch.mit.edu
Definitions:
Scratch: a visual programming language developed by MIT Technology Lab to make
programming easier and more fun to learn.
Sprite: a character (such as a cat) that understands and obeys the commands given to them.
Scripts: stacks of blocks you connect together to create commands
Script execution: when your script runs
Scratch Programming Envirnoment
Cursor Tools
Tabs
Menu Bar
Scripts Area
Blocks Palette
Stage
Sprite List
The Stage
Stage: where your sprites move, draw and interact
180
The stage is 480 steps wide and 360 steps tall.
X is horizontal
Y is vertical
-240
240
(0, 0)
You can find the coordinates of any area of the stage
by moving the mouse cursor to that point and watching
the numbers in the Mouse (x, y) display area.
-180
Backdrops Tab
You can change the background of the stage by opening a new
backdrop.
Sprite List
Each sprite on the list has own scripts, costumes and sounds.
Costumes Tab
You can change the appearance of sprites with costumes.
Sounds Tab
Sprites can play a wide variety of sounds. There are preexisting ones within Scratch or you can
record sounds (if your computer has a microphone) or import existing sound files from your
computer. Scratch can only read MP3 and WAV sound files.
Blocks Tab
There are 10 categories of code blocks in the Block Palette:
Motion: controls sprite placement, direction, rotation and movement
Looks: affect sprite and backdrop appearance and can display text
Sound: control playback and volume of audio
Pen: use to draw with different colors and pen styles
Data: store data to be used by applications when they execute
Events: trigger script execution
Control: execute programming logic using loops or conditional logic
Sensing: can determine location of mouse and sprites, whether touching something, etc.
Operators: perform logical comparisons
More Blocks: custom code blocks programmers can create
Scripts Area
This is the area where you can program the sprites to do things and for the background to change
by dragging and dropping blocks and snapping them together.
Types of Scratch Blocks
Stack blocks: a notch in the top and a bump at the bottom
o Can be attached to the underside of blocks and other blocks can be attached to it
Hat blocks: a rounded or curved top and bump on the bottom
o Can create an event-driven script
Reporter blocks: rounded sides
Boolean blocks: angled sides
+
=
o Designed as a mechanism for provding input for other blocks to process
o You need to embed in another block of code
C blocks: shaped like and named for the letter C
o Control blocks used to create a loop, grouped around other blocks
Cap blocks: notch on top and flat bottom
o signifes the end of a scriptcan only attach to other blocks