Comatour Devlog 4 – The Beginnings of an Item System
4/30/2022
Hello all, and welcome back to the Devlog!
Over this past week, I’ve been mainly working on the fundamentals of the game’s item system. Before I can add things like attacks, the player has to be able to actually pick up and hold a weapon, after all.
So, without further delay, let’s get into it:

In order to even start, I had to scrap the placeholder item system I was using. The reason for this being that the temporary system was just a couple lines of code in the items themselves, meaning it had no way of accounting for things like multiple items overlapping. This (as you might guess) could cause all sorts of issues if left that way.
With the placeholder gone, I began work on properly implementing what I call the “Inv” button. Now, this button allows you to pickup/drop items, swap your held item with your holstered item, and even open your inventory. Different actions are taken depending on whether you press or hold the button, the intention being to make it difficult to do things like accidently open your inventory in the middle of a fight.
With the button in, the next thing to add was the actual item pickup system itself. For this, I basically defined an area around the player that’s checked for items whenever the Inv button is pressed. When there are multiple items within this range, the system chooses the closest one, prioritizing whichever was checked last in the event two or more items are right on top of each other.
After a bit of testing and tweaking, the new system worked perfectly.
Next, I wanted to give the player options when it came to discarding unwanted items. Since the game follows a rogue (a class which can be known to use more underhanded tactics), I feel this is a great addition to the player’s move-set: The ability to throw whatever item they’re holding.
Imagine: fighting in a desert and throwing sand in your enemy’s eyes, drinking a health potion and chucking the empty bottle at a pursuer, or even throwing a blade to cut a rope from a distance (whatever that could be useful for).
Of course, you could also use this to toss items to your allies.
The last couple things of note I added are proper shadows for the items, an indicator on the player for when they’re ready to either swap or drop their item(s), and a Z axis to correctly distance the shadows from their respective items.
This last week has basically been all about items, to the point where the word “item” is starting to sound weird.
Anywho, that’s all for this one. I’ll see y’all in the next Devlog!