In this recipe, we'll create an inventory screen, which is very common, mostly in RPGs. To do this, we'll use the
Draggable components in Nifty and create an
InventoryItem class to help us differentiate different the types of items (and hence, where they can be attached). This time, we'll use both XML to create the static components and the Java Builder interface to build the inventory (or backpack) slots. The reason is that in many games, the amount of inventory a character has varies.
We begin by creating the controls, which are the key components of this method. This can be done by performing the following four steps:
inventoryControls.xml, with the ...