Skip to content

Commit 7036b4c

Browse files
content: Issue #982 - Text changes to Lesson 24 Access Array Indices (#1086)
Close #982 - Text changes to Goals and Starting Code to help learners understand the task and also the way the inventory works --------- Co-authored-by: Nathan Lovato <12694995+NathanLovato@users.noreply.github.com>
1 parent 6f3f74f commit 7036b4c

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

course/lesson-24-access-array-indices/lesson.tres

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,23 +220,25 @@ practice_id = "res://course/lesson-24-access-array-indices/practice-ErO9L4MW.tre
220220
title = "Using the right items"
221221
goal = "In our game, the player has an inventory that works as an array under the hood.
222222
223-
They want to equip a sword and a shield to buff their characters. Like before, we need you to find them in the array.
223+
The player knows they have a sword and a shield somewhere in their inventory, but they don't remember exactly where.
224224
225-
You need to access elements in the [code]inventory[/code] array by index to do so.
225+
You can see the inventory drawn on the right, along with the index of each item in the inventory.
226226
227-
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]."
227+
Your task is to find one sword and one shield in the array using their index, then call [code]use_item()[/code] on each of them so the player can equip those items.
228+
229+
For example, if the first item in the array is what you need, you would call [code]use_item(inventory[0])[/code]."
228230
starting_code = "var inventory = []
229231
230232
func pick_items():
231233
"
232234
cursor_line = 0
233235
cursor_column = 0
234-
hints = PoolStringArray( "Use the function [code]use_item(item)[/code], where [code]item[/code] is an element of the [code]inventory[/code] array", "Use [code]brackets[/code] to access specific array indices" )
236+
hints = PoolStringArray( "Use the function [code]use_item(index)[/code], where [code]index[/code] is the index of an item in the [code]inventory[/code] array", "Use [code]square brackets[/code] to access specific array indices" )
235237
validator_script_path = "res://course/lesson-24-access-array-indices/find-crystals/TestFindCrystals.gd"
236238
script_slice_path = "res://course/lesson-24-access-array-indices/find-crystals/FindCrystals.live-editor/slices/FindCrystals.pick.slice.tres"
237239
documentation_references = PoolStringArray( )
238240
documentation_resource = ExtResource( 1 )
239-
description = "Find the right items to use in the player's inventory."
241+
description = "Find the right items to use in the player's inventory, using their index."
240242

241243
[sub_resource type="Resource" id=21]
242244
script = ExtResource( 3 )

0 commit comments

Comments
 (0)