You are previewing Scratch™ 2.0 Programming for Teens, Second Edition.
O'Reilly logo
Scratch™ 2.0 Programming for Teens, Second Edition

Book Description

With Scratch 2.0, getting started in computer programming is easier and more fun than ever. And with this completely updated edition of the popular Scratch Programming for Teens, you'll learn the basics in a fast, friendly way and be sharing your creations online before you know it. Focused on the fundamentals and using the free Scratch programming language, Scratch 2.0 Programming for Teens will teach you to develop interactive stories, games, animations, and other programs on the web, in your computer's browser, using graphic, customizable code blocks. Written especially for first-time programmers, it emphasizes the design and development of programming logic. You'll learn important programming concepts without getting bogged down in complicated details. And the basic principles you learn here will build a foundation from which you can move on to other, more complex, programming languages (like Microsoft Visual Basic, Java, and C++), if you decide to go deeper into software development. Additional material, including helpful appendixes and a complete glossary, is available on a companion website. Start programming today with Scratch 2.0 Programming for Teens. Scratch is a project of the Lifelong Kindergarten group at the MIT Media Lab. Scratch, the Scratch logo, and the Scratch Cat are trademarks of the Massachusetts Institute of Technology.

Table of Contents

  1. Title Page
  2. Copyright Page
  3. Dedication
  4. ACKNOWLEDGMENTS
  5. ABOUT THE AUTHOR
  6. CONTENTS
  7. Introduction
  8. CHAPTER 1 INTRODUCING SCRATCH 2.0
    1. GETTING TO KNOW SCRATCH 2.0
    2. GETTING READY FOR SCRATCH 2.0
    3. CREATING YOUR FIRST SCRATCH 2.0 APPLICATION
    4. JOINING SCRATCH 2.0’S GLOBAL COMMUNITY
  9. CHAPTER 2 GETTING COMFORTABLE WITH THE SCRATCH 2.0 DEVELOPMENT ENVIRONMENT
    1. GETTING COMFORTABLE WITH THE SCRATCH 2.0 PROJECT EDITOR
    2. ADDING PROJECT INSTRUCTIONS, NOTES, AND CREDITS
    3. CREATING NEW SPRITES USING SCRATCH’S PAINT EDITOR
  10. CHAPTER 3 A REVIEW OF THE BASIC COMPONENTS OF SCRATCH PROJECTS
    1. WORKING WITH BLOCKS AND STACKS
    2. SIX BASIC TYPES OF SCRATCH BLOCKS
    3. KEEPING AN EYE OUT WITH MONITORS
    4. TEN CATEGORIES OF SCRATCH BLOCKS
    5. GETTING HELP WITH CODE BLOCKS
  11. CHAPTER 4 MR. WIGGLY’S DANCE—A QUICK SCRATCH PROJECT
    1. PROGRAMMING WITH SCRATCH
    2. CREATING THE MR. WIGGLY’S DANCE APPLICATION
  12. CHAPTER 5 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. BOUNCING SPRITES AROUND THE STAGE AND CONTROLLING ROTATION STYLE
    7. KEEPING TRACK OF SPRITE COORDINATES AND DIRECTION
    8. TAKING ADVANTAGE OF SCRATCH CARDS
    9. CREATING THE VIRTUAL SCRATCH FISH TANK
  13. CHAPTER 6 SENSING SPRITE POSITION AND CONTROLLING ENVIRONMENTAL SETTINGS
    1. WORKING WITH SENSING CODE BLOCKS
    2. DETECTING SPRITE COLLISIONS AND DISTANCE FROM OBJECTS
    3. PROMPTING FOR AND COLLECTING USER INPUT
    4. RETRIEVING KEYBOARD INPUT, MOUSE BUTTON, AND COORDINATE STATUS
    5. RETRIEVING AUDIO DATA
    6. COLLECTING AND PROCESSING VIDEO INPUT
    7. WORKING WITH A TIMER
    8. RETRIEVING STAGE AND SPRITE DATA
    9. RETRIEVING THE DATE, TIME DATA, AND USER’S NAME
    10. CREATING THE FAMILY SCRAPBOOK APPLICATION
  14. CHAPTER 7 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. A QUICK EXAMPLE
    6. STORING COLLECTIONS OF DATA IN LISTS
    7. DEVELOPING THE BASKETBALL QUIZ PROJECT
  15. CHAPTER 8 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. MANIPULATING STRINGS
    7. ROUNDING NUMBERS AND RETRIEVING REMAINDERS
    8. WORKING WITH BUILT-IN MATHEMATICAL FUNCTIONS
    9. DEVELOPING THE NUMBER GUESSING GAME QUIZ PROJECT
  16. CHAPTER 9 CONTROLLING SCRIPT EXECUTION
    1. INTRODUCING SCRATCH EVENTS AND CONTROL BLOCKS
    2. EVENT PROGRAMMING
    3. CONTROLLING SCRIPT EXECUTION
    4. DEVELOPING THE BALL CHASE GAME
  17. CHAPTER 10 CHANGING THE WAY SPRITES LOOK AND BEHAVE
    1. LOOKS BLOCKS THAT AFFECT SPRITES VERSUS THE STAGE
    2. MAKING SPRITES TALK AND THINK
    3. MAKING SPRITES APPEAR AND DISAPPEAR
    4. CHANGING SPRITE COSTUMES AND STAGE BACKDROPS
    5. APPLYING SPECIAL EFFECTS TO COSTUMES AND BACKDROPS
    6. CHANGING A SPRITE’S SIZE
    7. DETERMINING WHAT HAPPENS WHEN TWO SPRITES OVERLAP
    8. RETRIEVING COSTUME AND BACKDROP DATA
    9. DEVELOPING THE CRAZY EIGHT BALL GAME
  18. CHAPTER 11 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
  19. CHAPTER 12 DRAWING LINES AND SHAPES
    1. CLEARING THE STAGE AREA
    2. STAMPING AN INSTANCE OF A COSTUME ON THE STAGE
    3. DRAWING WITH THE PEN
    4. SETTING PEN COLOR
    5. CHANGING PEN SHADE
    6. WORKING WITH DIFFERENT SIZE PENS
    7. CREATING THE DOODLE DRAWING APPLICATION
  20. CHAPTER 13 IMPROVING CODE ORGANIZATION
    1. SIMPLIFYING SCRIPT ORGANIZATION THROUGH PROCEDURES
    2. ADDING CLARITY THROUGH COMMENTS
    3. SIMPLIFYING THE PROJECT AND REDUCING THE PROJECT SIZE WITH CLONING
    4. CREATING THE GONE FISHING APPLICATION
  21. CHAPTER 14 GAME DEVELOPMENT USING COLLISION DETECTION
    1. KEY FEATURES FOUND IN MOST COMPUTER GAMES
    2. DETECTING COLLISIONS
    3. COLLECTING PLAYER INPUT
    4. CREATING SCRATCH PONG
  22. APPENDIX A FINDING AND FIXING PROGRAM ERRORS
  23. APPENDIX B OFFLINE SCRATCH DEVELOPMENT
  24. APPENDIX C INTERACTING WITH THE REAL WORLD
  25. APPENDIX D WHAT NEXT?
  26. GLOSSARY
  27. INDEX