Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Inventory System Setup

Author: James Clarke

Posted on 5/5/2023

Today, I was able to successfully create an inventory for the player. This system involves the storing and removal of items as well as the ability to swap out items. There were a few issues I originally ran into such as understanding how an inventory where you are constantly using items to build recipes and/or holding on to items for later use. The biggest issue I ran into while trying to implement this inventory system was code organization. A lot of issues where many null references would pop up or where things had trouble being stored/removed from the inventory all derived from not using my code space as organized as it should have been.

The solution to this issue was to examine my code carefully and add parameter checks where I may have forgotten to add.  I was able to better understand my code and tried my best to use the most optimal solution for each individual problem. The way I organized my code involved separating bigger portions of "if checks" and separating more critical code into small functions to allow for better manipulation.  Now that I have gotten over this hurdle my next goal is to allow items in the inventory to be selected and swapped/removed from inventory and into the Player's hand. I have learned a great deal from my experience today and I will try my hardest to keep my code more organized. 

Support this post

Did you like this post? Tell us

Leave a comment

Log in with your itch.io account to leave a comment.