Book Image

Scratch 2.0 Beginner's Guide: Second Edition

By : Michael Badger
Book Image

Scratch 2.0 Beginner's Guide: Second Edition

By: Michael Badger

Overview of this book

Table of Contents (18 chapters)
Scratch 2.0 Beginner's Guide Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – adding comments to a script


Let's add a quick comment that annotates the broadcast block in the Happy Birthday sprite's script:

  1. Select the Happy Birthday script. Right-click somewhere in the scripts area and select add comment.

  2. In the yellow box that appears, type the following: the "hi mom" broadcast signals the second m sprite to start its animation.

  3. Now click on the yellow comment box and drag it to the broadcast (hi mom) block. Then, release the block. This can be tricky, but the goal is to attach the comment to the block. See the following screenshot:

What just happened?

Commenting our code is one of those things that we should always do more often because it helps other people understand our code. And in reality, this can help us understand what we did when we open a project we haven't worked on in months.