Post news RSS Planning out the Inventory system.

A look into the Inventory system of Legend of Karnn.

Posted by on

Heya folks! At the moment, the inventory system for Legend of Karnn is in development and I thought it'd be nice to show a little about how I went about planning such a system.

In order to include an inventory into LoK, I needed to also implement item types so I set up 5 classes to this: Item, Consumable, Quest, Equippable & Aesthetic. The latter four classes inherit off of the Item class. This allows me to use a generalized set of functions and variables in all of the sub-classes!

LoK Inventory setup!

So there it is, the Inventory class has the functions you'd expect from it such as addItem() and removeItem() as well as an item container (itemList). You may wonder why the Aesthetic sub-class has no variables or functions. I did this so it's easier to identify items that would be aesthetic and I haven't thought of any item specific functions or variables for that class yet :s.

The current situation of Inventory implementation:
- I have the Inventory's display(), addItem(), itemList and Backgorund working after a little work (getting screwed over by playing too much tekkit!).
- I also have dynamic memory allocation on the equippable item sub-class as well as putting that into the itemList.

What's next to do with the Inventory?
The next thing for me to do is to set up the coordinates for item positions and make functions to check if there is space for new items to be added. After that I plan to get the rest of the functions down. I think it's important for me to not rush a main system of the game and make sure that it's well programmed as the player will be using it a lot throughout the game!

What's next after the Inventory?
What I plan to do after (but it also helps the inventory system) is to make a system to control the player's stats in one place, these would include stats such as:
- Health
- Mana
- Resistance
- Power
- Gold
- Items acquired
- Items equipped

Cheers for reading!


Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.