Chapter 7. Games of Fortune

In Chapter 6, we learned how easy it is to create projects that incorporate dynamic information using variables. However, variables have a limitation; they store only one value at a time. Sometimes, we want a variable to store multiple values.

Welcome to lists. In Scratch, a list allows us to associate one list (a variable) with multiple items or values in much the same way we create a list before going to the grocery store.

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

  • Store and retrieve information in lists
  • Keep track of items in a list by using a counter
  • Identify intervals using the mod block
  • Use if/else control blocks to make decisions
  • Ask the user a question and store the keyboard input

That's a lot to process, but we can do it.

Fortune-teller

Most of us enjoy a good circus, carnival, or county fair. There's fun, food, and fortunes. Aah, yes, what would a fair be without the fortune-teller's tent? By the end of the chapter, you'll know everything you need to spin your fortunes and amaze your friends with your wisdom.

Before we start the first exercise, create a new project and add two sprites. The first sprite will be the seeker. The second sprite will be the teller. Choose any sprites you want. My seeker will be a clam and my teller will be a snowman. If you want to add a background, go ahead.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.111.243