Quick Action Buttons: Displaying
Let's Do It
Back to work on the game after frustration at my day job. Nothing too bad, just the same person who has been causing me headaches for a while now. I'm good though, ready to make something happen! Let's get those quick action buttons looking right instead of the stupid placeholder graphic I'm using. First step is verify where I should start. Looking around, I made sure that I am calling the placeholder function to update the buttons from somewhere. That functionality exists, only things I need is to flesh out the placeholder "update" function.
What does that look like? I need to touch each button, so I need to know my button IDs. Quick comment before the function to remind myself is needed here. Then I just. . . what? Do I just touch each one individually? Do I use an incrementing loop? I think the first option may be the best, since I'm having to address each actual button node directly. Hmm, how complicated should I write my statements? Each of the four will basically be the same. Do I nest IFs, or do I build out a long complicated comparison?
I think nested conditionals is the way to go, if only to prevent confusing complexity. Just means the function will have more lines of code, but it really shouldn't be any slower. If anything it'll be better this way for when I have to come back and update the function later. I'm starting by copying the code I built yesterday for the button press. The logic is sound, just a few modifications to make it work with a specific button and do a different thing. Once I've got the first button built, I can then copy/paste the same code 3 more times with minor changes and all will be good.
Repetition
So, I know this is bad, but it's the easiest way to make it work now. Later, it can be made better. For now though, I have a function that consists of four nearly identical blocks of code. When I add abilities to the mix it'll mean updating each of the four separate blocks again, which will possibly cause more issues. I know there are many ways to make this better, but I really don't care to do that right now. I could easily setup some sort of variable to iterate through that references the buttons directly by their number. . . actually, that's really smart, that's exactly what I should do. Instead of using 4 separate variables to hold the individual button nodes, I could use a single dictionary, keyed to their button ID.
But doing that would require refactoring other places, probably. Actually, would it? I'd have to refactor my button signal connections, and this new function, that's it. Hmm, this is actually a good idea. But not something I want to do today. So, I dropped a comment near the variable declarations to refactor it later. I'll worry about doing that once I add more complexity to the buttons themselves, like when I start building out active abilities.
Time To Test
Firs thing, I see that my buttons appear a little weird. This is okay! There's nothing assigned to each button, so they really should just have a "default" look (which doesn't exist yet). But the functionality to update the way the buttons look is working perfectly! During testing I did notice one thing I wanted to correct, the choice the player makes when assigning a quick action button remains the active selection. My first instinct was to force it back to the starting option immediately upon setting it, but that just looks weird and doesn't have the right kind of feedback for the player.
Instead, I decided to force a reset to option zero when the player chooses another item or when I force a clear of the item detail panel. This was a much better approach in my opinion. Eventually, in time, I will want to have the item detail panel automatically detect if the selected item is assigned to a quick action button and display appropriately. But for now, this works great! The player selects which slot and it sticks for that item until a new item is selected or the inventory is closed (the item detail panel is cleared).
There is still one small bit of this that isn't quite working the way I'd like, the timing for my quick action button display update. When the player has the inventory open, it is transparent so the buttons appear "through" the inventory screen. The update of the icon doesn't happen until after the inventory is closed. So the player can change quick action button assignments, and the actual look isn't changed. I'm not too worried about this though, since the inventory screen isn't complete yet, and will probably not stay transparent.
Next Time
With that all out of the way, I'm done with today's session. Another huge win, this one will really pay off. Now I've got a reliable system for survival. We have feedback on the player's vitals. We have inventory access, including in-inventory item usage and the ability to assign the items to buttons for easy access in the game world. I'm really not sure exactly what to work on next, since there's still so much more to do for the vertical slice. But this is still such great progress and the momentum will carry me for today.
Xenodochium
The future is what you make of it!
| Status | In development |
| Author | Munchmo |
| Genre | Role Playing |
| Tags | 2D, Cozy, Godot, Indie, Life Simulation, Pixel Art, Sci-fi, Singleplayer |
| Languages | English |
More posts
- Consumables and Controller Safety1 day ago
- Quick Actions: Preparations2 days ago
- Quick Actions: Assigned!3 days ago
- Road Trip!4 days ago
- Playerstats: Refactored!5 days ago
- Data Manager: Effects and Thresholds6 days ago
- Effects: Underwhelming9 days ago
- Inventory Manager: Quick Actions10 days ago
- Inventory: Updates11 days ago
Leave a comment
Log in with itch.io to leave a comment.