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 – renaming sprites


Let's rename our sprites by performing the following steps:

  1. Select Sprite1 from the sprite list and click on the blue i icon to display the sprite properties. Change Sprite1 to Happy Birthday.

  2. Rename the remaining sprites with a memorable name, such as First M, Second M, and O.

Each sprite in the list can now be identified by a unique name.

What just happened?

To the computer, Sprite3 is just as good as First M, but humans benefit from associating sprites, costumes, backdrops, lists, variables, and messages to a descriptive name. In our example project, we spell mom from individual sprites. How do we know if Sprite2 is the First M or the last M? But if we rename Sprite2 to First M, we have no doubt.

In addition to providing context, names provide a way for us to easily identify our objects later. For example, if we broadcast one message as message 1 and another as message 2, we may not know which message does what when it's time to make a sprite perform an...