Introduction
Many games involve the player collecting items or choosing from a selection of items. Examples could be collecting keys to open doors, collecting ammo for weapons, choosing from a collection of spells to cast, and so on.
The recipes in this chapter offer a range of solutions for displaying to the player whether they are carrying an item or not, if they are allowed more than one of an item, and how many they have.
The big picture
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, secondly, how we choose to display information about inventory items to the player (the UI: User Interface).
Also, whilst not strictly inventory items, player properties such as lives left, health, or time remaining can also be designed around the same concepts that we present in this chapter.
We need to first think about the nature of different inventory...