Chapter 15Carrying (and Using) Stuff
In Chapters 13 and 14, we took a break from coding our game to clean up our code. We are going to continue doing that in this chapter, this time focusing on how to carry and use items.
Planning the Inventory System
Every adventure game requires that the player obtain and use items. Maybe you need to collect coins to buy an item from a story. The coins you collect are items, as is whatever you buy. Or perhaps you encounter a door that is locked, and it’ll only open if you have found a particular item: a key. Items can be maps, food, potions, weapons, you name it.
In your game, for example, the structure ...
Get Captain Code: Unleash Your Coding Superpower with Python now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.