Hud Prefab: More Updates
Still Not Feeling It
These late night meetings for my day job combined with the actual workload are leaving me drained and not wanting to do anything too complicated for Xenodochium. But this project is important to me, so even when I'm not in the mood, I'm still going to push through to get something done.
Get To Work
So, that's what I did. I jumped in and just picked up where I left off yesterday, the HUD prefab. After much thought, I decided on adding the menu button panel down the right side of the screen. This will contain (so far) my player's on-screen access to the pause menu, the character menu, and the player's inventory. It's possible at some point that I will end up adding more buttons, but for now those are the only actions only available via keypress (except for the dynamic action button, which I added yesterday).
Of course, nothing actually does anything, so it was time to dive into the code. First up, time to add references for the buttons themselves. 8 new variables, and a few drag and drops later and that was done. Next up was actually making the menu buttons work, which was actually pretty easy. A simple validation check in ready (is it a valid instance?) followed by the connection to a dedicated function for each. These functions are just a simple call to press and immediate release of their corresponding actions.
Test Time
Of course, it is never quite as simple as that! In testing, the buttons did nothing . . . So I added a couple of quick debug lines to verify the functions are actually firing. And the debug messages show that the functions are working, but the mimicked keypress does nothing. Turns out, the way this stuff works isn't how I expected. Since I'm using into _unhandled_input() for these actions, the mimicked keypress isn't caught.
So, instead I decided to just directly change the game state. This worked exactly how I wanted, so it's the best approach (for now). Eventually, I may want to refactor the game manager's input handling to separate the actions from the logic. Doing this would allow me to call those functions directly, keeping a central place for the changes. But those "actions" are basically just changing the game state anyway!
Next Time
That's all I care to do today. There's still so much more to do in relation to the HUD prefab, specifically the dynamic and quick action buttons. Those will be much more involved than today's changes though, so I'll dig in next time. I guess the first thing I'll need to do is add more keys to my input map to cover these things. I want to be able to both trigger them from on screen, via keyboard, or even from a controller. But that's a problem for another day because today's session was a success!
Who knows, maybe one day I'll even add the ability for the player to remap their controls. . .
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
- Troubleshooting: Input23 hours ago
- HUD Prefab: Layout Changes3 days ago
- Virtual Joystick: It's Alive4 days ago
- Virtual Joystick: Wiring In4 days ago
- Planning Is Work6 days ago
- Refactor: Troubleshooting7 days ago
- User Config Refactor: Completed?8 days ago
- User Config Refactor: Continued9 days ago
- User Config Refactor: Planning9 days ago
Leave a comment
Log in with itch.io to leave a comment.