Scratch 1.4: Beginner's Guide
()
About this ebook
If you have the imaginative power to design complex multimedia projects but can't adapt to programming languages, then Scratch 1.4: Beginner's Guide is the book for you. Imagine how good you'll feel when you drag-and-drop your way to interactive games, stories, graphic artwork, computer animations, and much more using Scratch even if you have never programmed before.
This book provides teachers, parents, and new programmers with a guided tour of Scratch's features by creating projects that can be shared, remixed, and improved upon in your own lesson plans. Soon you will be creating games, stories, and animations by snapping blocks of "code" together.
When you program you solve problems. In order to solve problems, you think, take action, and reflect upon your efforts. Scratch teaches you to program using a fun, accessible environment that's as easy as dragging and dropping blocks from one part of the screen to another.
In this book you will program games, stories, and animations using hands-on examples that get you thinking and tinkering. For each project, you start with a series of steps to build something. Then you pause to put our actions into context so that you can relate our code to the actions on Scratch's stage. Throughout each chapter, you'll encounter challenges that encourage you to experiment and learn.
One of the things you're really going to love is that, as you begin working through the examples in the book, you won't be able to stop your imagination and the ideas will stream as fast as you can think of them. Write them down. You'll quickly realize there are a lot of young minds in your home, classroom, or community group that could benefit from Scratch's friendly face. Teach them, please.
This hands-on tutorial teaches you the basics of computer programming using Scratch, a drag-and-drop language, so you can teach your students how to think and create digitally
ApproachThis is a Packt Beginners Guide, which means it focuses on practical examples and has a friendly approach, with the opportunity to learn by experiment and play. We work through the project tutorials one block of code at a time, and we periodically pause to reflect on the relationship between our code blocks, our project, and Scratch programming in general. As you work through the book, you are encouraged to experiment with the concepts presented. As each chapter in the book progresses, the topics get increasingly more complex.
Who this book is forScratch is a teaching language, so it's ideal for people who want to learn how to program or teach others how to program. Educators and parents will learn how to program using Scratch, so they can use Scratch to teach the latest learning skills to their students and children.
No previous computer programming knowledge is required. You only need to know how to perform basic tasks on a computer and this book will teach the rest. You can then use it as a platform to learn more advanced programming languages.
Parents, stuck with a child who wants to play video games all night? Make a new rule. He can only play a video game if he programs the game first.
Michael Badger
Micheal Badger is a technical communicator with a history of helping others to use their computer software and technology. For fun, Michael reads computer books and blogs about technology. When he finally decides to disconnect, he spends his spare time fishing, growing pigs, raising honeybees, and tending the family. Michael also wrote Zenoss Core Network and System Monitoring, a step-by-step guide to configuring the open source IT monitoring software application.
Read more from Michael Badger
Zenoss Core 3.x Network and System Monitoring Rating: 0 out of 5 stars0 ratingsScratch 2.0 Beginner's Guide Second Edition Rating: 4 out of 5 stars4/5
Related to Scratch 1.4
Related ebooks
Fun Games with Scratch 3.0: Learn to Design High Performance, Interactive Games in Scratch (English Edition) Rating: 0 out of 5 stars0 ratingsScratch Cookbook Rating: 0 out of 5 stars0 ratingsLearning Primary Programming with Scratch (Home Learning Book Years 3-4) Rating: 0 out of 5 stars0 ratingsCoding for Kids Ages 10 and Up: Coding for Kids and Beginners using html, css and JavaScript Rating: 5 out of 5 stars5/5Hello Scratch!: Learn to program by making arcade games Rating: 0 out of 5 stars0 ratingsPython Apps on Visual Studio Code: Develop apps and utilize the true potential of Visual Studio Code (English Edition) Rating: 0 out of 5 stars0 ratingsScratch For Kids For Dummies Rating: 0 out of 5 stars0 ratingsScratch 2.0 Programming Rating: 3 out of 5 stars3/5Code-It Workbook 2: Choices In Programming Using Scratch Rating: 0 out of 5 stars0 ratingsScratch 2.0 Game Development - HOTSHOT Rating: 1 out of 5 stars1/5Coding Programs For Kids: Parents Guidebook: How Your Child Can Learn To Code And The Benefits For Their Future: Parenting Rating: 0 out of 5 stars0 ratingsCode-It Workbook 4: Problem Solving Using Scratch Rating: 0 out of 5 stars0 ratingsApp Inventor 2 Essentials Rating: 3 out of 5 stars3/5Code-It Workbook 3: Algorithm to Code Using Scratch Rating: 0 out of 5 stars0 ratingsCode-It Workbook 1: First Steps in Programming using Scratch Rating: 0 out of 5 stars0 ratingsHelping Kids with Coding For Dummies Rating: 0 out of 5 stars0 ratingsLearn to Code with Scratch: Let Your Kids' Creative Ideas Come to Life by Coding Them into Programs Rating: 0 out of 5 stars0 ratingsYou Can't Dance to These Rhythms: What Are Algorithms? Rating: 0 out of 5 stars0 ratingsDesigning Digital Games: Create Games with Scratch! Rating: 0 out of 5 stars0 ratingsCoding For Kids For Dummies Rating: 0 out of 5 stars0 ratingsThis Python Isn't a Snake: What Are Coding Languages and Syntax? Rating: 0 out of 5 stars0 ratingsMission Ruby Rating: 0 out of 5 stars0 ratingsCreative Coding: Lessons and Strategies to Integrate Computer Science Across the 6-8 Curriculum Rating: 0 out of 5 stars0 ratingsBugs That Make Your Computer Crawl: What Are Computer Bugs? Rating: 0 out of 5 stars0 ratingsThe Everything Kids' Scratch Coding Book: Learn to Code and Create Your Own Cool Games! Rating: 4 out of 5 stars4/5Learn to Code With JavaScript Rating: 0 out of 5 stars0 ratingsTeaching Primary Programming with Scratch Pupil Book Year 3 Rating: 0 out of 5 stars0 ratingsCoding For Everybody: CodeWithUtkarsh Rating: 0 out of 5 stars0 ratingsCoding for Kids: Scratch and Python Basics-Learn to Code the Fun Way! Rating: 0 out of 5 stars0 ratings
Information Technology For You
AWS Certified Cloud Practitioner: Study Guide with Practice Questions and Labs Rating: 5 out of 5 stars5/5CompTIA A+ CertMike: Prepare. Practice. Pass the Test! Get Certified!: Core 1 Exam 220-1101 Rating: 0 out of 5 stars0 ratingsCompTia Security 701: Fundamentals of Security Rating: 0 out of 5 stars0 ratingsDesign and Build Modern Datacentres, A to Z practical guide Rating: 3 out of 5 stars3/5An Ultimate Guide to Kali Linux for Beginners Rating: 3 out of 5 stars3/5Creating Online Courses with ChatGPT | A Step-by-Step Guide with Prompt Templates Rating: 4 out of 5 stars4/5Data Analytics for Beginners: Introduction to Data Analytics Rating: 4 out of 5 stars4/5Introduction to Information Systems: Information Technology Essentials, #1 Rating: 0 out of 5 stars0 ratingsA Mind at Play: How Claude Shannon Invented the Information Age Rating: 4 out of 5 stars4/5CompTIA Security+: Network Attacks Rating: 5 out of 5 stars5/5How to Write Effective Emails at Work Rating: 4 out of 5 stars4/5Personal Knowledge Graphs: Connected thinking to boost productivity, creativity and discovery Rating: 5 out of 5 stars5/5CompTIA ITF+ CertMike: Prepare. Practice. Pass the Test! Get Certified!: Exam FC0-U61 Rating: 5 out of 5 stars5/5COMPUTER SCIENCE FOR ROOKIES Rating: 0 out of 5 stars0 ratingsCompTIA Network+ CertMike: Prepare. Practice. Pass the Test! Get Certified!: Exam N10-008 Rating: 0 out of 5 stars0 ratingsChatGPT: The Future of Intelligent Conversation Rating: 4 out of 5 stars4/5Cyber Security Consultants Playbook Rating: 0 out of 5 stars0 ratingsMachine Learning Interview Questions Rating: 5 out of 5 stars5/5Practical Ethical Hacking from Scratch Rating: 5 out of 5 stars5/5Learning Microsoft Endpoint Manager: Unified Endpoint Management with Intune and the Enterprise Mobility + Security Suite Rating: 0 out of 5 stars0 ratingsCharacter Expression: Using ChatGPT to Write Believable Emotions in Fiction Rating: 3 out of 5 stars3/5A Practical Guide for IoT Solution Architects Rating: 5 out of 5 stars5/5Health Informatics: Practical Guide Rating: 0 out of 5 stars0 ratingsThe Domains of Identity: A Framework for Understanding Identity Systems in Contemporary Society Rating: 0 out of 5 stars0 ratingsCreating your MySQL Database: Practical Design Tips and Techniques Rating: 3 out of 5 stars3/5The Rise of AI Income: Using Artificial Intelligence for Financial Success Rating: 5 out of 5 stars5/5Understanding AI: A Comprehensive Guide for Beginners Rating: 0 out of 5 stars0 ratingsObject-Oriented JavaScript: Create scalable, reusable high-quality JavaScript applications, and libraries Rating: 3 out of 5 stars3/5
Reviews for Scratch 1.4
0 ratings0 reviews
Book preview
Scratch 1.4 - Michael Badger
Table of Contents
Scratch 1.4 Beginner's Guide
Credits
About the Author
About the Reviewer
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code for the book
Errata
Piracy
Questions
1. Welcome to Scratch!
What is Scratch?
21st century learning skills
How to use Scratch?
Programming concepts
Programming limitations
Scratch anatomy
Building blocks
Write the script
Watch the story
Built-in image editor
Interface promotes tinkering
Learning Scratch
Welcome to Scratch!
Installation
Start Scratching
Graphics and Slideshows
Storytelling
Arcade Games
Games of Fortune
Math and Finance
Share!
Real-world stimuli
Summary
2. Installation
Install Scratch
Windows
Run Scratch from flash drive
Integrate Scratch with the PortableApps.com suite
Installation on Macintosh
Run Scratch on USB flash drive
Installation on Linux
Troubleshooting
Limitations
Wine and Scratch
Confirm Java install
Customize your Scratch installation
Redistribute Scratch freely
Source code license
Share alike
Summary
3. Start Scratching
The interface at a glance
Time for action – first step
What just happened?
Basics of a Scratch project
We're all actors on Scratch's stage
Pop quiz
Time for action – save your work
Set the cat in motion
Time for action – a big step
What just happened?
Coordinating a sprite's location
Double-click control
Pop quiz
Time for action – in motion forever
What just happened?
Loops play it again
Time for action – get out of the corner
What just happened?
Have a go hero
Undo an action
Pop quiz
Add sprites to the stage
Get new sprites
Time for action – spin sprite spin
What just happened?
Have a go hero
Pop quiz
Sometimes we need inspiration
Browse Scratch's projects
Time for action – spinner
What just happened?
Costume versus background
Time for action – broadcast a message
What just happened?
Broadcast messages coordinate sprites
Pop quiz
Browse the Scratch community
Time for action – create an account
What just happened?
Abide by the terms of use
Time for action – download a project
What just happened?
Creative Commons
Have a go hero
Summary
4. Graphics and Slideshows
Happy birthday wishes
Time for action – paint a happy birthday sprite
What just happened?
Interface design
Set the stage
Time for action – paint the stage
What just happened?
Adding gradients
Have a go hero
Pop quiz
Sprite costumes
Time for action – address the card
What just happened?
Working with sprites
Animating the card
Time for action – hide all sprites
What just happened?
Time for action – display happy birthday
What just happened?
Sprite names
Time for action – roll call
Choose appropriate names
Graphical transformations
Time for action – give me an M
What just happened?
Loop with repeat
Pop quiz
Incremental improvements
Time for action – give me another M
What just happened?
Time for action – set first M straight
What just happened?
Have a go hero – give me an O
Beware of gaudiness
Time for action – give mom flowers
What just happened?
Ghosting an image
Have a go hero
Parallel execution
Next steps
Build a photo slideshow
Time for action – insert a title screen
What just happened?
Time for action – import photos from disk
What just happened?
Image formats
Working with images
Resize images
How to measure images
Time for action – flip through the photos
What just happened?
Have a go hero
Building audience participation
Time for action – present your show
Pop quiz
Next steps
Summary
5. Storytelling
Barnyard humor
Table of contents
Time for action – create TOC
What just happened?
Have a go hero
Add pages to our book
Time for action – add new pages
What just happened?
Hide that sprite
Time for action – hide the sprites
Introducing the horse
Time for action – import the horse
Costumes versus sprites
The horse speaks
Time for action – the horse talks
What just happened?
Synchronize the action
Time for action – revise the horse talks exercise
What just happened?
Sound
Time for action – a horse whinnies
What just happened?
Sound formats
The dog enters
Time for action – bring out the dog
X and Y coordinates mark the spot
Time for action – stay dog
What just happened?
Position on the grid
Pop quiz
Pointed in the right direction
Time for action – turn to the left
What just happened?
Degrees of direction
Sound effects
Time for action – hit the cymbals
What just happened?
Select an instrument
Time for action – applause, please
What just happened?
Play a note
Have a go hero
Pop quiz
Piece the dog scene together
Time for action – joke, please
What just happened?
Have a go hero
Control the story
Time for action – hide TOC
What just happened?
Have a go hero
Time for action – enter dog
What just happened?
Time for action – exit dog
What just happened?
Have a go hero
Time for action – show TOC
What just happened?
Have a go hero
Build sequence
Have a go hero
Next steps
Summary
6. Arcade Games
Troll pong
Time for action – open the sample pong project
What just happened?
Dynamic interaction
Variables
Time for action – change direction
What just happened?
Time for action – remove the random turn
What just happened?
Have a go hero
Customize the sprites
Time for action – beach ball pong
What just happened?
Have a go hero
Time for action – add new paddle controls
What just happened?
Play theme music, forever
Time for action – add background music
What just happened?
Do something, forever
Working with sound
Have a go hero
Pop quiz
Forever, on one condition
Time for action – paddle meets ball
What just happened?
Start single stepping
What just happened?
Conditional statements
Pop quiz
What's the score?
Time for action – add a score variable
What just happened?
For all sprites
For this sprite only
Time for action – count the paddle's steps
What just happened?
Global versus local variables
Have a go hero
Add a second level
Time for action – reach for a new level
What just happened?
Comparisons
Troubleshooting
Time for action – fix the script
What just happened?
Using Boolean logic
Pop quiz
Add levels
Time for action – count the levels
What just happened?
Have a go hero
Time for action – enter project notes
What just happened?
Next steps
Summary
7. Games of Fortune
Fortune-teller
Time for action – create a list of questions
What just happened?
Have a go hero
Work with an item in a list
Import a list
Time for action – import a list of fortunes
What just happened?
Reasons to import
Export a list
Pop quiz
Your fortune is …
Time for action – tell me a fortune
What just happened?
Time for action – force a positive fortune
What just happened?
Counters
Keep track of intervals with mod
Have a go hero
If/else
Pop quiz
Repeat the fortune
Time for action – my fortune is what?
What just happened?
Holding text in a variable
Do you have a question?
Time for action – ask your question
What just happened?
Add the question to the list
Time for action – add it to the list
What just happened?
Join two text phrases
Time for action – join two sentences
What just happened?
Nest join blocks
Additional string operations
Next steps
Summary
8. Math and Finance
Double it or lump sum?
Double it
Time for action – calculate the double amount
What just happened?
Have a go hero
Time for action – set user-defined variables
What just happened?
Start single stepping
Time for action – slow it down
Graph the values
Time for action – set the graph’s origin
What just happened?
Time for action – draw a graph
What just happened?
Mathematical functions
Create patterns with stamp
Pop quiz
Connect the dots
Time for action – connect the dots
What just happened?
Time for action – fix the graph
Follow a sprite with the go to block
Draw with the pen tool
Time for action – draw the x and y axis of the grid
What just happened?
Have a go hero
Label the newAmount value
Time for action – label newAmount
What just happened?
Pop quiz
Find the interest earned on a lump sum
Time for action – calculate interest on lump sum
What just happened?
Have a go hero
Round to nearest whole number
Have a go hero
Next steps
Summary
9. Share!
Share with the Scratch community
Reduce file size
Time for action – compress media files
What just happened?
Share!
Time for action – share!
What just happened?
Tag it
Update a project
Trouble?
Firefox display problems
Variables change positions
Link to your project
Embed in a blog post
Embed an applet or an image?
Share via social networks
Subscribe to projects via RSS
How to subscribe
Host your Scratch projects
Install files to a web server
Time for action – install files on a web server
What just happened?
Limitations of self-hosting
Pop quiz
Summary
10. Real-world stimuli
Import webcam pictures
Time for action – say cheese
What just happened?
Working with camera images
Export a sprite
PicoBoard—what is it?
Order a PicoBoard
Install the PicoBoard
Connect the PicoBoard
Capture sound input
Time for action – switch backgrounds on sound
What just happened?
Have a go hero
Sound as a numeric value
Time for action – use sound to change the sprite's looks
What just happened?
Have a go hero
Click for the next slide
Time for action – click for the next slide
What just happened?
True or false values
Time for action – wait until button not pressed
What just happened?
Step into the light, please
Time for action
What just happened?
Using light to detect motion
Have a go hero
Control motion with the slider
Time for action – slide sensor
What just happened?
Using gravity
Have a go hero
Create circuits
Time for action – complete the circuit
What just happened?
Wiring our projects
Measure electrical resistance
Time for action – measure resistance
What just happened?
Using resistance
Have a go hero
Watch all sensor values
Have a go hero
Pop quiz
LEGO WeDo support
Summary
A. Scratch Resources
Index
Scratch 1.4 Beginner's Guide
Michael Badger
Scratch 1.4 Beginner's Guide
Copyright © 2009 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, Packt Publishing, nor its dealers or distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: July 2009
Production Reference: 1060709
Published by Packt Publishing Ltd.
32 Lincoln Road
Olton
Birmingham, B27 6PA, UK.
ISBN 978-1-847196-76-7
www.packtpub.com
Cover Image by Vinayak Chittar (<[email protected]>)
Credits
Author
Michael Badger
Reviewer
Tom McKearney
Acquisition Editor
David Barnes
Development Editor
Dhiraj Chandiramani
Technical Editor
Abhinav Prasoon
Indexer
Rekha Nair
Editorial Team Leader
Gagandeep Singh
Project Team Leader
Lata Basantani
Project Coordinator
Joel Goveya
Proofreader
Jade Schuler
Production Coordinator
Shantanu Zagade
Cover Work
Shantanu Zagade
About the Author
Michael Badger is a technical communicator with a history of helping others use their computer software and technology. For fun, Michael reads computer books and blogs about technology. When he finally decides to disconnect, he spends his spare time fishing, growing pigs, raising honeybees, and tending the family.
Michael also wrote Zenoss Core Network and System Monitoring, a step-by-step guide to configuring, using, and adapting the free Open Source network monitoring system.
Share your feedback about this book at http://www.scratchguide.com.
Writers work hours at a time in isolation, but bringing a book from concept to finished product requires the support of many people. My support starts at home with my wife Christie's encouragement and my son Cameron's early bedtime. Cameron, when you're old enough to read, we'll create some games together.
Early in this project, I received thoughtful, timely, and sensible feedback from my editor David Barnes. Thanks for the great advice.
I thank the reviewer, who took time to read and respond critically to my work for which I will be forever grateful. Know that I appreciate every correction, suggestion, and improvement he offered. This book benefits from his attention.
About the Reviewer
Tom McKearney has been doing custom software development for 16 years on projects ranging from Automated Weather Observation, Vehicle Management Systems, Biometric Identification, Battle Simulations, and various financial applications. He is a self-described geek
whose hobbies include tinkering with random electronics parts, beer brewing and reading excessively. Tom lives in the suburbs of Baltimore, Maryland, and currently specializes in Microsoft's .NET technologies while working for Applied Information Sciences (www.appliedis.com) in Reston, Virginia, U.S.
He was previously a technical reviewer of Quality Web Systems: Performance, Security, and Usability,
Addison-Wesley Professional (September 2, 2001), 0201719363 written by Elfriede Dustin, Jeff Rashka, and Douglas McDiarmid.
Go to http://www.pearsonhighered.com/educator/academic/product/0,3110,0201719363,00.html for more information about this book.
Preface
When we program, we solve problems. In order to solve problems, we think, take action, and reflect upon our efforts. Scratch teaches us to program using a fun, accessible environment that's as easy as dragging and dropping blocks from one part of the screen to another.
In this book, we will program games, stories, and animations using hands-on examples that get us thinking and tinkering. For each project, we start with a series of steps to build something. Then, we pause to put our actions into context so that we can relate our code to the actions on Scratch's stage. Throughout each chapter, you'll encounter challenges that encourage you to experiment and learn.
As you begin working through the examples in the book, you won't be able to stop your imagination, and the ideas will stream as fast as you can think of them. Write them down. You'll quickly realize there are a lot of young minds in your home, classroom, or community group that could benefit from Scratch's friendly face. Teach them, please.
What this book covers
Chapter 1 provides an overview of Scratch, its features, and how it can help you teach 21st century learning skills to your children and students.
Chapter 2 guides us through the installation of Scratch on Windows, OS X, and Linux. This chapter also helps you run the Scratch programming environment from a USB flash drive.
Chapter 3 explores the Scratch interface and allows us to create some simple scripts that demonstrate how easily we can build a project. This is a high-speed tour of Scratch that gets us tinkering and thinking about what's possible.
Chapter 4 teaches us how to create an animated birthday card and a slideshow of our favorite photos.
Chapter 5 allows us to horse around as we develop a barnyard humor book that lets us narrate multiple scenes. There's no need to hold the applause.
Chapter 6 takes a classic pong game and gives it a little personality by adding a troll, switching levels, and keeping score.
Chapter 7 takes us to the fortune-teller, but before we learn the random answers to all our deepest questions, we must create our game using the Magic 8 ball's fortunes.
Chapter 8 uses mathematical formulas and graphs to help us answer the question, Would you rather have a dollar that doubles every day or a lump sum of money?
The answer may surprise you.
Chapter 9 explains how to share your project with the Scratch community and how to promote it to you friends and fans.
Chapter 10shows us how to connect a webcam and an external sensor board to our computer and delivers real-world stimuli as input to Scratch projects.
What you need for this book
All you need is an imagination and a willingness to experiment. You will also need a computer with Scratch 1.4 installed. Most modern computers should easily run the latest version of Scratch; however, the Scratch team makes Scratch 1.2.1 available on the Scratch Download page for older systems. Here are the system requirements as defined by the Scratch team:
Display: 1024 x 768
16-bit color or higher
Disk Space: At least 120 MB
Operating Systems:
Windows 2000 or higher for Scratch 1.3
Windows 98 users can use Scratch 1.2.1
Mac OS X 10.4 for Scratch 1.3
Mac OS X 10.3 for Scratch 1.2.1
Linux support via WINE
Native Linux support is experimental
If you want to take advantage of Scratch's audio and recording features, you will need a sound card, speakers, and a microphone.
Who this book is for
Scratch is a teaching language, so it's ideal for people who want to learn how to program or teach others how to program. Educators and parents will learn how to program using Scratch, and they can use Scratch to teach 21st century learning skills to their students and children.
The 21st century learning skills help develop digital literacy by teaching children how to design, think critically, collaborate, communicate, and program in a computer language.
No previous computer programming knowledge is required. If you know how to send email, create documents, or