You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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>
goal = "In our game, the player has an inventory that works as an array under the hood.
222
222
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.
224
224
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.
226
226
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]."
228
230
starting_code = "var inventory = []
229
231
230
232
func pick_items():
231
233
"
232
234
cursor_line = 0
233
235
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" )
0 commit comments