jesse_harrison
jesse_harrison 19h ago • 0 views

Scratch Arrays/Lists: Example Code for Storing Player Lives

Hey everyone! 👋 Ever wondered how to keep track of player lives in your Scratch games using arrays (lists)? 🤔 It's easier than you think! This guide and quiz will help you master it. Let's jump in!
💻 Computer Science & Technology
🪄

🚀 Can't Find Your Exact Topic?

Let our AI Worksheet Generator create custom study notes, online quizzes, and printable PDFs in seconds. 100% Free!

✨ Generate Custom Content

1 Answers

✅ Best Answer
User Avatar
sarah_price Dec 29, 2025

📚 Quick Study Guide

  • 💾 Arrays/Lists: Ordered collections of data. In Scratch, these are called lists.
  • Adding elements: Use the 'add thing to list' block to append new items to a list.
  • Removing elements: Use the 'delete (1) of list' block to remove items. Adjust the index to remove specific elements.
  • 🔢 Accessing elements: Use the 'item (1) of list' block to retrieve an item at a specific index.
  • Checking Length: The 'length of list' block returns the number of items in the list. This is crucial for checking if a player has any lives left.
  • 🔄 Iterating through lists: Use a loop with a counter to access each element in the list sequentially.
  • 💖 Representing Lives: You can store the number of lives directly as a number in a variable, or use a list where each element represents a life (e.g., heart icons).

🧪 Practice Quiz

  1. What Scratch block is used to add a life (represented as a heart icon) to the 'Lives' list?
    1. A. insert thing at (1) of [Lives]
    2. B. add (heart icon) to [Lives]
    3. C. replace item (1) of [Lives] with (heart icon)
    4. D. set [Lives] to (heart icon)
  2. How can you remove one life from the 'Lives' list in Scratch?
    1. A. change [Lives] by (-1)
    2. B. delete (last) of [Lives]
    3. C. replace item (1) of [Lives] with ()
    4. D. set [Lives] to (length of [Lives] - 1)
  3. Which block returns the number of lives currently in the 'Lives' list?
    1. A. item # of [Lives]
    2. B. contents of [Lives]
    3. C. length of [Lives]
    4. D. number of [Lives]
  4. If the 'Lives' list is empty, what does that indicate about the player?
    1. A. The player has infinite lives.
    2. B. The game is paused.
    3. C. The player has lost all their lives.
    4. D. The player has gained a life.
  5. Which of the following is NOT a valid way to use a list to store player lives in Scratch?
    1. A. Each item in the list represents one life.
    2. B. The length of the list represents the number of lives.
    3. C. Storing the number of lives directly in a variable, not using a list.
    4. D. Storing the player's score in the list along with lives.
  6. How can you access the second life represented in the 'Lives' list?
    1. A. item (1) of [Lives]
    2. B. item (2) of [Lives]
    3. C. item (0) of [Lives]
    4. D. last item of [Lives]
  7. What happens if you try to access 'item (5) of [Lives]' when the list only has 3 items?
    1. A. The game crashes.
    2. B. It returns the last item in the list.
    3. C. It returns an empty value or throws an error (depending on Scratch version).
    4. D. It adds two new items to the list to reach index 5.
Click to see Answers
  1. B
  2. B
  3. C
  4. C
  5. D
  6. B
  7. C

Join the discussion

Please log in to post your answer.

Log In

Earn 2 Points for answering. If your answer is selected as the best, you'll get +20 Points! 🚀