This might as well be called the month of “Inventory UI”. It’s been the only thing I’ve worked on thus far, and just when I think I’m done, I’m like, “Oh shit, I should probably support this minor feature as well”. Minor features are, well, minor, but a dozen of them = month of “Inventory UI” 🙂

Item Swapping

The main feature I worked on today was swapping. Recently, I put in a feature that allowed double clicking to equip/unequip items. The natural question of “What happens when there is already an item in the target slot” arose, so I realized I needed to implement some swapping functionality.

Lucky for me, I’ve added a lot of functionality to the many item/inventory systems over the past month, so being able to detect if a target slot was occupied was pretty easy. It was also pretty easy to wire up the UI code to do the actual swapping of the items.

It took a little more work to make sure the underlying data structures that represent the inventory and equipment slots were also synced up with the swapping.

I think the best part is that now that I have this type of logic in, I can abstract it out a bit and use for other systems. In other words, this item swapping doesn’t have to be specific to items. It could be for adding abilities to a hot bar, or for a UI based crafting system. Pretty much everything I’ve done with this inventory system (UI and underlying systems) can (and will) be re-purposed.

Item Attributes Now Displayed On UI

If you blinked, you may have missed that there are 4 new panels above the equipment slots:

  • Damage
  • Armor
  • Hit %
  • Dodge %

What I’m showing on the UI for each panel is the sum value of each attribute for all the equipped items. Now, you’ll be able to get a higher level understand of how strong you are when all items are….

….Jesus Christ, why am I explaining this? 🙂 Anyone here is a fan of RPG’s, so you all know god damn well what it is.

Adding them was pretty easy. The most labor intensive part was making sure to update the panels whenever a piece of equipment is added/removed.

So everything I’ve done in today’s update can be seen in the GIF. There are of course some things I’d like to have added at some point in the future, such as some sort of indication when the values on the attributes panel change, or when an item is swapped out. Maybe the item attribute number/item icon start out a little larger, than gradually shrink to their normal size? ¯\_(ツ)_/¯

Yeah yeah, I know, it’s a prototype, so time to move on.

Till tomorrow…