Virtual Joystick: Configuring
Back At It
So, after yesterday's slightly disappointing progress I'm back to try to get this thing working. I'm not really in the mood for it though. Super late work meetings (ended at nearly midnight last night) followed by interrupted sleep and an early morning have left me feeling a bit drained. But that doesn't matter because I must continue my progress! So, I guess the first step is figuring out exactly how this thing works.
First I took a look at the scene included in the plugin. It's just a simple controller circle, and I really only need one I think. There's only character movement (for now) that I'll be controlling, no cameras. Eventually I'll want to add other buttons for in-game functions, such as opening the inventory or character menu. But for the time being I'm only interested in controlling player movement on mobile. So, the first step, it seems, is to create a new inherited scene and save it for use later.
This left me wondering where the best location was for saving this scene. And the answer actually led me down another small rabbit hole. I decided to re-arrange my folder structure slightly to take all of my UI elements and group them into a separate parent folder, ui_elements. This actually cleaned up my file structure a lot, less folders in the root of my scenes. Once that was done, it was time to actually configure the joystick, which was a breeze. All I needed to do was update four variables in the inspector for my movement inputs.
Once that was done, the next step was to update my UI manager to reference this new scene. But then I had to get into the logic of whether this thing should even appear on the screen or not. And that involved a few specific checks and new variables in my game manager. So now I have my game manager attempting to detect the OS, figuring out whether a controller is connected, and even seeing whether the player wants to force the virtual joystick.
Where I Stop
So, after a lot of discussion with Gemini about the best practices in handling this, I have found I need to refactor a portion of my existing code. You see, I want the player to be able to decide for themselves whether the virtual joystick appears or not, with the option for automatic detection as well. And not only that, I want this setting to persist across sessions. The problem is, the best place for saving the persistence is in a config file. But at the moment I've already got something saving a config file, and trying to save a new one would break things.
This means I need to update my audio handler to look at my savegame manager for my config instead of handling the check internally. This will allow me to then also use the savegame manager for persisting the user's preference surrounding the virtual joystick. But, because of my exhaustion and how long I've already been at this, that's for tomorrow. I'm going to have to refactor a few existing systems to make this work. I need to move all reading and writing of my config file into the savegame manager, and update the existing scripts to reference it, which will be a bit of a complicated task.
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
- Virtual Joystick: Plugging In1 day ago
- Fixing Bugs at the Mall2 days ago
- Let's Talk: Taking a Break8 days ago
- Inputs: Handled11 days ago
- Item Acquisition: Quest Complete12 days ago
- Quest Manager: Item Acquisition13 days ago
- Dialogue: Wrapped14 days ago
- Pickup: Items15 days ago
- Data Manager: String Formatting17 days ago
Leave a comment
Log in with itch.io to leave a comment.