The_Official_Raspberry_Pi_-_Beginner’s_Book_Vol1,_2018 (1)

(singke) #1

116 THE OFFICIAL RASPBERRY PI BEGINNER'S GUIDE


5 Figure 5-18: You have added another room

Empty rooms aren’t much fun, though. To add an item to a room, you’ll need to modify that
room’s dictionary. Stop the program by clicking the Stop icon. Find the Hall dictionary in the
scripts area, then add a comma to the end of the line 'east' : 'Dining Room' before
pressing ENTER and typing the following line:

'item' : 'key'

Click on Run again. This time, the game will tell you that you can see your new item: a key.
Type ‘get key’ (Figure 5-19) and you can pick it up, adding it to the list of items you’re carrying


  • known as your inventory. Your inventory stays with you as you travel from room to room.


5 Figure 5-19: The collected key is added to your inventory
Free download pdf