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

Chapter 8. Chatting with a Fortune Teller

In the Breakout game we created in the previous chapters, we learned how easy it is to create projects that keep track of the changing values by using variables. However, variables have a limitation in they store only one value at a time. In this chapter, we're going to create a random fortune-spewing teller, which will require the sprites to have access to a list of multiple values at one time.

Welcome to lists. In Scratch, a list feature allows us to associate one list with multiple items or values in almost the same way we create a list before going to the grocery store. We can think of the items in the list as variables. Each list item can be changed, removed, or added to.

In this chapter, we will take a trip to the fortune teller to demonstrate lists, and I am sure you'll learn how to:

  • Store and retrieve information in lists

  • Prompt the player for project inputs, check for errors, and identify patterns with the mod block

  • Use the if () then else...