I am currently making a survival/exploration game, and I am having a small setback. Making an inventory! Can anybody give me some tips, or an example of an inventory that allows you to click to move items, and a hotbar to move items to.


1 2 3 4 5 | private Actor slot1; slot1 = new InventorySlot(); getWorld().addObject(slot1, 10 , 10 ); |
1 2 3 | private InventorySlot[] slots = new InventorySlot[ < max slot count > ]; for ( int i= 0 ; i<slots.length; i++) slots[i] = new InventorySlot(); |
1 2 3 4 | protected void addedToWorld(World world) { for ( int i= 0 ; i<slots.length; i++) world.addObject(slot[i], < wherever >); } |
1 2 | World world = getWorld(); // or '= this;', if in world class world.removeObject(world.getObjects(InventorySlot. class )); |