Chapter 16Keeping It Classy
You now have a functioning inventory system that allows players to obtain, carry, and use items. And your game can adapt based on inventory items. The next thing you need is a player management system. To create this, we’ll introduce you to classes, which are the focus of this chapter.
The Player System
In Chapter 15, you used a dictionary to create an inventory system. We used that to hide a key that the player needed to find in order to unlock the door.
But, let’s be honest, we did a pretty lousy job of hiding the key. A player can just go to the boulders, and—ta-da!—there it is. In a real game, you’d typically ...
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.