O'Reilly logo

jMonkeyEngine 3.0 Cookbook by Rickard Edén

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating an inventory screen

In this recipe, we'll create an inventory screen, which is very common, mostly in RPGs. To do this, we'll use the Droppable and 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.

How to do it...

We begin by creating the controls, which are the key components of this method. This can be done by performing the following four steps:

  1. First, we create a new controls file, inventoryControls.xml, with the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required