itch.io is community of indie game creators and players

Devlogs

Inventory: Item Details

Xenodochium
A browser game made in HTML5

Getting To Work

The internet isn't working where I am right now, but I have access to a mobile hotspot, so I'm using that while I work. I'm not sure yet exactly what work I'm going to do, but I'll get something done. I've started by going back to my Planning Is Work post to refresh myself on what I planned and to figure out where to start.

The best first approach is going to be the inventory screen. I need to start there by adding more functionality and improving the overall design. First step is going to be changes to my inventory slot scene. Or maybe an update to the inventory scene itself? Whatever shall I do? I know, I'll fire up a chat with Gemini to talk through the process and figure out the specific details of what needs to happen. And that's just what I did.

Talking It Through

I laid it out to Gemini. I fed it a copy of my existing inventory script, and described what I have and what I want. Gemini pretty much laid out exactly what I was thinking. I need to add a button somewhere in my item slot scene. Then in my inventory script I need to add a bit more when I instantiate the slot, to create a connection for the button press, as well as disconnect the signal when the slot is empty. I'll also need a function for the button to connect to. Then there's building out the whole item detail panel. 

As expected, the first step is to build out the item detail container. This means figuring out exactly what I want to show the player. That means diving into my item definitions to see what kind of data I have. Obviously, there's the display name. That's an easy one to add. Then there's the description, another quick and easy add. I need to account for quantity, so that's another easy label to add. Obviously, we need to show the player a nice picture of the item too, so a texture rect is added for that. 

That's all well and good, but now comes the buttons. How many do I need? What exactly do I want the player to be able to do with items. Obviously, I'll need at least one context button, but is one enough? The specific reason I'm doing this work now is to allow the player to consume food. So that's one contextual action. I should probably allow the player to discard most items, so that's another. This one I'm not so sure about though. With an infinite inventory, is there really a reason to allow the player to discard items? Maybe instead I should add a "mark as junk" option. Then have my inventory manager maintain a list of "junk" to more easily allow the player to recycle/sell items.

All The Buttons!

So I added all the buttons, even ones I'm not sure about. There's "Consume", "Equip", "Discard", and "Junk". It was at this point that I realized I needed more localization work! Off to Google Sheets I go to add more keys and text. Luckily, localization is super easy now! I'm so happy with how I built things. If I hadn't already done the localization work I'd have a much harder time adding it later.

Then there's my quick action buttons. How do I easily allow assignment of an item to a quick action slot without cluttering the page with four new buttons? I asked Gemini what it suggested, and I didn't really like it's idea of using some sort of popup or contextual menu. Instead I went with a simple option button. Next up is actually scripting some of this stuff. So the first step is adding variables to hold these new elements I've added to the inventory. Nine export variables created, set, and ready for use!

The Final Polish (Deferred)

It doesn't exactly look pretty, but I'm also not done yet. Well, I am done for today. I've not made anything work, but I've done the majority of my setup work for the next session. This leaves me in a good place to stop, and has me set for success as I continue to chip away at the game. Today's session leaves me with a lot of coding to do. But I'm ready for it and I'm excited to keep plugging away.

Leave a comment