O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Scratch™ Programming for Teens

Book Description

Welcome to Scratch Programming for Teens! Scratch is a programming language intended to make programming easier to learn for novice programmers. It can be used to create computer games, interactive stories, graphic artwork and computer animation, and all sorts of other multimedia projects. Scratch can also be used to play digital music and sound effects. If you aspire to one day become a professional programmer, Scratch provides everything you need to build a foundation. Scratch also packs all of the programming power and punch needed to satisfy the programming needs of most computer enthusiasts and hobbyists. Best of all, it's actually fun to use! Scratch Programming for Teens provides all the instruction that a first-time programmer needs to quickly get up and running with Scratch. Before you know it, you will be creating all kinds of projects that incorporate graphics, sound, and animation. As you learn how to program with Scratch, you will learn programming principles and techniques that you can later apply to other programming languages such as Microsoft Visual Basic and AppleScript. Jerry Lee Ford, Jr. is an author, educator, and an IT professional with over 18 years of experience in information technology, including roles as an automation analyst, technical manager, technical support analyst, automation engineer, and security analyst. He is the author of 24 other books and co-author of two additional books. His published works include AppleScript Studio Programming for the Absolute Beginner, Programming for the Absolute Beginner, and DarkBASIC Programming for the Absolute Beginner. Jerry has a master's degree in business administration from Virginia Commonwealth University in Richmond, Virginia, and he has over five years of experience as an adjunct instructor teaching networking courses in information technology.

Table of Contents

  1. Copyright
  2. Acknowledgments
  3. About the Author
  4. Introduction
  5. Scratch Basics
    1. Introducing Scratch
      1. Getting to Know Scratch
      2. Installing Scratch
      3. Creating Your First Scratch Application
      4. Joining Scratch’s Global Community
      5. Summary
    2. Getting Comfortable with the Scratch Development Environment
      1. Getting Comfortable with the Scratch IDE
      2. Creating New Sprites Using Scratch’s Paint Editor
      3. Summary
    3. A Review of the Basic Components of Scratch Projects
      1. Working with Blocks and Stacks
      2. Three Basic Types of Scratch Blocks
      3. Keeping an Eye Out with Monitors
      4. Eight Categories of Scratch Blocks
      5. Getting Help with Code Blocks
      6. Summary
    4. Mr. Wiggly’s Dance—A Quick Scratch Project
      1. Programming with Scratch
      2. Creating the Mr. Wiggly’s Dance Application
      3. Distributing Scratch Projects
      4. Summary
  6. Learning How to Write Scratch Programs
    1. Moving Things Around
      1. Working with Motion Code Blocks
      2. Moving and Rotating Sprites
      3. Setting Sprite Direction
      4. Repositioning a Sprite
      5. Changing Sprite Coordinates
      6. Keeping Track of Sprite Coordinates and Direction
      7. Taking Advantage of Scratch Cards
      8. Creating the Virtual Scratch Fish Tank
      9. Summary
    2. Sensing Sprite Position and Controlling Environmental Settings
      1. Working with Sensing Code Blocks
      2. Retrieving Mouse Button and Coordinate Status
      3. Determining when Keys Are Pressed
      4. Determining when Sprites Collide with Other Objects
      5. Determining Distance
      6. Working with a Timer
      7. Retrieving Stage and Sprite Data
      8. Retrieving Audio Data
      9. Code Blocks That Work with Sensor Boards
      10. Creating the Family Scrapbook Application
      11. Summary
    3. Storing and Retrieving Data
      1. Learning How to Work with Application Data
      2. Storing Data in Variables
      3. Deleting Variables when They Are No Longer Needed
      4. Accessing Variables Belonging to Other Sprites
      5. Working with Variable Monitors
      6. Two Quick Examples
      7. Developing the Basketball Quiz Project
      8. Summary
    4. Doing a Little Math
      1. Addition, Subtraction, Multiplication, and Division
      2. Understanding the Mathematical Order of Precedence
      3. Generating a Random Number
      4. Comparison Operations
      5. Performing Logical Comparisons
      6. Rounding Numbers and Retrieving Remainders
      7. Working with Built-in Mathematical Functions
      8. Developing the Number Guessing Game Quiz Project
      9. Summary
    5. Conditional and Repetitive Logic
      1. Introducing Scratch Control Blocks
      2. Event Programming
      3. Pausing Script Execution
      4. Executing Loops
      5. Sending and Receiving Broadcasts
      6. Conditional Programming Logic
      7. Terminating Script Execution
      8. Developing the Ball Chase Game
      9. Summary
    6. Changing the Way Sprites Look and Behave
      1. Changing Sprite Costumes and Backgrounds
      2. Making Sprites Talk and Think
      3. Applying Special Effects to Costumes and Backgrounds
      4. Changing a Sprite’s Size
      5. Making Sprites Appear and Disappear
      6. Determining What Happens when Two Sprites Overlap
      7. Developing the Crazy Eight Ball Game
      8. Summary
    7. Spicing Things Up with Sounds
      1. Playing Sounds
      2. Play a Drum
      3. Playing Musical Notes
      4. Configuring Audio Volume
      5. Setting and Changing Tempo
      6. Creating the Family Picture Movie
      7. Summary
    8. Drawing Lines and Shapes
      1. Clearing the Stage Area
      2. Drawing with the Pen
      3. Setting Pen Color
      4. Changing Pen Shade
      5. Working with Different Size Pens
      6. Stamping an Instance of a Costume on the Stage
      7. Creating the Doodle Drawing Application
      8. Summary
  7. Advanced Topics
    1. Sharing Your Scratch Projects over the Internet
      1. Running Scratch Applications on the Internet
      2. Registering with the Scratch Website
      3. Uploading Your Scratch Applications
      4. Viewing and Organizing Your Applications Online
      5. Downloading Other People’s Projects
      6. Summary
    2. Collecting External Input Using a Scratch Board
      1. Interacting with the Real World
      2. Buying a Scratch Board
      3. Installing Your Scratch Board
      4. Using the Button Control to Initiate Action
      5. Summary
    3. Finding and Fixing Program Errors
      1. Dealing with Application Errors
      2. Debugging Your Scratch Applications
      3. Watch Out when Removing Sounds and Sprites
      4. Getting Help
      5. Summary
  8. Appendices
    1. What’s on the Companion CD?
      1. Scratch Project Source Code
      2. Scratch Installation Files for Microsoft Windows and Mac OS X
    2. What Next?
      1. Locating Scratch Resources Online
      2. Recommended Reading
  9. Glossary