use of com.bladecoder.engine.model.Inventory in project bladecoder-adventure-engine by bladecoder.
the class InventoryUI method getItemAt.
public SpriteActor getItemAt(float x, float y) {
if (x < margin || y < margin || x >= getWidth() - margin || y >= getHeight() - margin)
return null;
Inventory inventory = World.getInstance().getInventory();
int i = ((rows - 1) - ((int) (y - margin) / (tileSize + (int) rowSpace))) * cols + (int) (x - margin) / (tileSize + (int) rowSpace);
if (i >= 0 && i < inventory.getNumItems()) {
// inventory.getItem(i).getDesc());
return inventory.get(i);
}
return null;
}
Aggregations