Inventory and Advanced UIs
Many games involve the player collecting or choosing from a selection of items. Examples include collecting keys to open doors, collecting ammo for weapons, and choosing from a collection of spells to cast.
The recipes in this chapter provide a range of solutions for displaying to the player whether they are carrying an item or not, whether they are allowed more than one of a given item, and how many they have.
The two parts of software design for implementing inventories relate to, first, how we choose to represent the data about inventory items (that is, the data types and structures to store the data) and, second, how we choose to display information about inventory items to the player (the UI).
Also, while not strictly inventory items, player properties such as lives left, health, and time remaining can also be designed around the same concepts that we will present in this chapter.
First, we need to think about the nature of different...