Skip to content

content: Issue #982 - Text changes to Lesson 24 Access Array Indices #1086

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions course/lesson-24-access-array-indices/lesson.tres
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,19 @@ practice_id = "res://course/lesson-24-access-array-indices/practice-ErO9L4MW.tre
title = "Using the right items"
goal = "In our game, the player has an inventory that works as an array under the hood.

They want to equip a sword and a shield to buff their characters. Like before, we need you to find them in the array.
The player knows they have a sword and a shield somewhere in their inventory, but they don't remember exactly where.

You need to access elements in the [code]inventory[/code] array by index to do so.
You can see the inventory drawn on the right, along with the index of each item in the inventory.

Call the [code]use_item()[/code] function with the item as an argument to use an item. For example, you can use the first item by calling [code]use_item(inventory[0])[/code]."
Your task is find one sword and one shield in the array, then call [code]use_item()[/code] on each of them so the player can equip those items.

For example, if the first item in the array is what you need, you would call [code]use_item(inventory[0])[/code].
starting_code = "var inventory = []

# Before pick_items() is called, we will fill
# the inventory variable with the items shown
# on the right

func pick_items():
"
cursor_line = 0
Expand Down