Scratch 1.4 Reference GuideIntroduction | Scratch Interface | Scratch Blocks | Block Descriptions | Appendix 1. INTRODUCTIONScratch is a new programming language that makes it easy to create interactive stories, games, and animations – and share your creations with others on the web. Scratch is developed by the Lifelong Kindergarten Group at the MIT Media Lab, with financial support from the National Science Foundation, Microsoft, Intel Foundation, Nokia, and the MIT Media Lab research consortia. BASIC INGREDIENTS OF A SCRATCH PROJECTScratch projects are made up of objects called sprites. You can change how a sprite looks by giving it a different costume. You can make a sprite look like a person or a train or a butterfly or anything else. You can use any image as a costume: you can draw an image in the Paint Editor, import an image from your hard disk, or drag in an image from a website. 2. SCRATCH INTERFACESTAGEThe Stage is where you see your stories, games, and animations come to life. Sprites move and interact with one another on the Stage. The Stage is 480 units wide and 360 units tall. It is divided into an x-y grid. The middle of the Stage has an x-coordinate of 0 and a y-coordinate of 0.
To find out x-y positions on the Stage, move the mouse (cursor) around and look at the mouse x-y display just below the Stage Click the Presentation Mode button when you want to present your project. To exit Presentation Mode, press the Esc key. Click the View Mode buttons to switch between small and large stage view. You can use small stage view to display Scratch on small screens or to expand the Scripts Area. NEW SPRITESWhen you start a new Scratch project, it begins with a single cat sprite. Paint your own costume for a new sprite using the Paint Editor. If you want to delete a sprite, select the scissors from the Toolbar and click on the sprite. Or right-click (Mac: Ctrl+click) on the sprite and select delete from the pop-up menu. SPRITE LISTThe Sprite List displays thumbnails for all sprites in a project. The name of each sprite appears below its thumbnail.
BLOCKS PALETTE and SCRIPTS AREATo program a sprite, drag blocks from the Blocks Palette to the Scripts Area. To run a block, click on it. To clean up the Scripts Area, right-click (Mac: Ctrl+click) and select clean up from the menu. To export a screenshot of the Scripts Area, right-click and select save picture of scripts. COSTUMESClick the Costumes tab to see and edit the sprite’s costumes. To switch to a different costume, simply click on the thumbnail of the costume you want.
Scratch recognizes many image formats: JPG, BMP, PNG, GIF (including animated GIF). SOUNDSClick the Sounds tab to see the sprite’s sounds.
CURRENT SPRITE INFO
ROTATION STYLEClick the Rotation Style buttons to control how the costume appears as the sprite changes its direction. TOOLBARClick on the Toolbar to select a tool, then click on other objects to perform an action. MENU
GREEN FLAGThe Green Flag provides a convenient way to start many scripts at the same time. PAINT EDITORYou can use the Paint Editor to create or edit costumes and backgrounds. The Paint Editor Toolbar has the following tools:
Line: Draw a straight line (Shift+drag for a horizontal or vertical line) using the current foreground color. When you click on this tool, the Options Area shows the brush size. Click to pick a different brush size. 3. SCRATCH BLOCKSTYPES OF BLOCKSThere are three main types of blocks in the Blocks Palette: Some reporter blocks have a check box next to them, such as . If you click in the check box, a monitor appears on the stage, displaying the current value of the reporter. As the value of the reporter changes, the monitor updates automatically. A monitor can display the value of the reporter in several different formats: LISTSYou can create and manipulate lists in Scratch. Lists can store numbers as well as strings of letters and other characters. STRINGSStrings are made of letters, words, or other characters (e.g., apple; October 2009; You win!). KEYBOARD INPUTYou can use to prompt a user to type in a response on the keyboard. The response is stored in . The question appears on the screen and the program waits until the Enter key is pressed or the check mark is clicked.
is shared by all sprites (global) and is replaced each time runs. If you want to save the current , you can store it in a variable or list. BLOCK DESCRIPTIONSThe Scratch blocks are organized into eight color-coded categories: Motion, Looks, Sound, Pen, Control, Sensing, Operators, and Variables. MotionMoves sprite forward or backward. Rotates sprite clockwise. Rotates sprite counterclockwise. Points sprite in the specified direction. (0=up, 90=right, 180=down, -90=left) Moves sprite to specified x and y position on Stage. Moves sprite to the location of the mouse-pointer or another sprite. Moves sprite smoothly to a specified position over specified length of time. Changes sprite's x-position by specified amount. Sets sprite's x-position to specified value. Changes sprite's y-position by specified amount. Sets sprite's y-position to specified value. Turns sprite in opposite direction when sprite touches edge of Stage. Reports sprite's x-position. (Ranges from -240 to 240) Reports sprite's y-position. (Ranges from -180 to 180) Reports sprite's direction. (0=up, 90=right, 180=down, -90=left) Motor BlocksThe motor blocks only appear if you choose Show Motor Blocks in the Edit menu or if you plug in a LEGO WeDo. These blocks work with a LEGO WeDo motor. (See http://www.legoeducation.com) Turns motor on for specified amount of time. Turns motor on. Turns motor off. Sets power of motor and turns motor on. (Ranges from 0 to 100) Sets direction of a motor, but does not turn the motor on. (this way = clockwise; that way = counterclockwise; reverse = change direction) LooksChanges sprite's appearance by switching to different costume. Changes sprite's costume to next costume in the costume list. (If at end of the costume list, jumps back to first costume.) Reports sprite's current costume number. Changes Stage's appearance by switching to a different background. Changes Stage's background to next background in the background list. Reports Stage's current background number. Displays sprite's speech bubble for specified amount of time. Displays sprite's speech bubble. (You can remove speech bubble by running this block without any text.) Displays sprite's thought bubble for specified amount of time. Displays sprite's thought bubble. Changes a visual effect on a sprite by specified amount. (Use pull-down menu to choose effect.) Sets a visual effect to a given number. (Most visual effects range from 0 to 100.) Clears all graphic effects for a sprite. Changes sprite's size by specified amount. Sets sprite's size to specified % of original size. Reports sprite's size, as % of original size. Makes sprite appear on the Stage. Makes sprite disappear from the Stage. (When sprite is hidden, other sprites cannot detect it with the touching? block.) Moves sprite in front of all other sprites. Moves sprite back a specified number of layers, so that it can be hidden behind other sprites. SoundStarts playing a sound, selected from pull-down menu, and immediately goes on to the next block even as sound is still playing. Plays a sound and waits until the sound is finished playing before continuing with next block. Stops playing all sounds. Plays a drum sound, selected from pull-down menu, for specified number of beats. Plays a musical note (higher numbers for higher pitches) for specified number of beats. Rests (plays nothing) for specified number of beats. Sets the type of instrument that the sprite uses for play note blocks. (Each sprite has its own instrument.) Changes sprite's sound volume by specified amount. Volume ranges from 0 to 100. Sets sprite's sound volume to specified value. Reports sprite's sound volume. Changes sprite's tempo by specified amount. Sets sprite's tempo to specified value in beats per minute. Reports sprite's tempo in beats per minute. PenClears all pen marks and stamps from the Stage. Puts down sprite's pen, so it will draw as it moves. Pulls up sprite's pen, so it won't draw as it moves. Sets pen's color, based on choice from color picker. Changes pen's color by specified amount. Sets pen's color to specified value. (pen-color=0 at red end of rainbow, pen-color=100 at blue end of rainbow) Changes pen's shade by specified amount. Sets pen's shade to specified amount. (pen-shade=0 is very dark, pen-shade=100 is very light) Changes pen's thickness. Sets pen's thickness. Stamps sprite's image onto the Stage. ControlRuns script below when green flag is clicked. Runs script below when specified key is pressed. Runs script below when sprite is clicked. Waits specified number of seconds, then continues with next block. Runs the blocks inside over and over. Runs the blocks inside a specified number of times. Sends a message to all sprites, triggering them to do something, and waits until they all finish before continuing with next block. Sends a message to all sprites, then continues with the next block without waiting for the triggered scripts. Runs script below when it receives specified broadcast message. Continually checks whether condition is true; whenever it is, runs the blocks inside. If condition is true, runs the blocks inside. If condition is true, runs the blocks inside the if portion; if not, runs the blocks inside the else portion. Waits until condition is true, then runs the blocks below. Checks to see if condition is false; if so, runs blocks inside and checks condition again. If condition is true, goes on to the blocks that follow. Stops the script. Stops all scripts in all sprites. SensingReports true if sprite is touching specified sprite, edge, or mouse-pointer. (Selected from pull-down menu.) Reports true if sprite is touching specified color. (Click on color patch, then use eyedropper to select color.) Reports true if first color (within sprite) is touching second color (in background or another sprite). (Click on color patch, then use eyedropper to select color.) Asks a question on the screen and stores keyboard input in the . Causes the program to wait until Enter key is pressed or check mark is clicked. Reports keyboard input from the most recent use of . Shared by all sprites (global). Reports the x-position of mouse-pointer. Reports the y-position of mouse-pointer. Reports true if mouse button is pressed. Reports true if specified key is pressed. Reports distance from the specified sprite or mouse-pointer. Sets the timer to zero. Reports the value of the timer in seconds. (The timer is always running.) Reports a property or variable of another sprite. Reports the volume (from 1 to 100) of sounds detected by the computer microphone. Reports true if computer microphone detects a sound volume greater than 30 (on scale of 1 to 100). Reports the value of specified sensor. To use this block, you need a sensor connected to your computer. You can use this with a Scratch sensor board (http://www.playfulinvention.com/picoboard.html) or with LEGO® WeDo™ (http://www.legoeducation.com). Reports true if specified sensor is pressed. To use this block, you need to have a Scratch sensor board connected to your computer. (See http://www.playfulinvention.com/picoboard.html) OperatorsAdds two numbers. Subtracts second number from first number. Multiplies two numbers. Divides first number by second number. Picks a random integer within the specified range. Reports true if first value is less than second. Reports true if two values are equal. Reports true if first value is greater than second. Reports true if both conditions are true. Reports true if either condition is true. Reports true if condition is false; reports false if condition is true. Concatenates (combines) strings. Reports the number of letters in a string. Reports the letter at the specified position in a string. Reports result of selected function (abs, sqrt, sin, cos, tan, asin, acos, atan, ln, log, e^, 10^) applied to specified number. Reports remainder from division of first number by second number. VariablesAllows you to create and name a new variable. When you create a variable, the blocks for that variable will appear. You can choose whether the variable is for all sprites (global) or just for one sprite (local). Deletes all blocks associated with a variable. Reports value of the variable. Changes the variable by specified amount. If you have more than one variable, use the pull-down menu to select the variable name. Sets the variable to specified value. Shows the variable monitor on the stage. Hides the variable monitor so it is not visible on the stage. Allows you to create and name a new list. When you create a list, the blocks for that list will appear. You can choose whether the list is for all sprites (global) or just for one sprite (local). Deletes the blocks associated with the list. Reports all the items in the list. Adds the specified item to the end of the list. The item can be a number or a string of letters and other characters. Deletes one or all items from a list. You can choose from the pull-down menu, or use a number to specify which item to delete. Choosing ?last? deletes the last item in the list. Choosing ?all? deletes everything from the list. Deleting decreases the length of the list. Inserts an item at the specified position in the list. You can choose from the pull-down menu, or use a number to specify where to insert the item. Choosing ?last? adds the item to the end of the list. Choosing ?any? inserts at a random place in the list. The length of the list increases by 1. Replaces an item in the list with the specified value. You can choose from the pull-down menu, or use a number to specify which item to replace. Choosing ?last? replaces the last item on the list. Choosing ?any? replaces a random item in the list. The length of the list does not change. Reports the item at the specifed position in the list. You can choose from the pull-down menu, or use a number to specify which item to report. Choosing ?any? reports a random item in the list. Reports how many items are in the list. Reports true if the list contains the specified item. (The item must match exactly to report true.) 4. APPENDIXSYSTEM REQUIREMENTS FOR SCRATCH VERSION 1.4Computer OS: NETWORK INSTALLATION AND CUSTOMIZATIONFor more information and updates on network installation and customization, please see the readme.txt file or : http://info.scratch.mit.edu/Network_Installation.
|