Consumables and Controller Safety


What To Do?

Super late night last night with meetings for my "day" job. I put it in quotes, since the meetings were at night. That's my fault though, since I'm on the other side of the world from where my day job is situated. It's all good though, it's a trade off I agree to so I can travel so much. Doesn't help that I'm still sick. I actually woke up this morning without my voice. Sinus and congestion issues led to be being unable to speak for hours. Very frustrating. I feel perfectly fine though, which is weird. Not really even congested anymore, but my voice is all messed up. I can actually speak now, mostly.

Anyway, on to the game! Before I dive in to my original plan, I was thinking about a post I saw on Reddit. It talked about how you should make it so your game is automatically paused if a controller disconnects. I thought that was a great idea, so I tried to set myself a reminder in my Gemini chat. Of course, it took it upon itself to make all sorts of assumptions and even wrote some useless code for me. Oh well. I kinda gave it a tongue lashing and then decided to figure out the right way to implement this for my game.

As it turned out, due to the VJ stuff (I think) I had already partially put some of the needed pieces into place. So, I quickly whipped up what I needed to, and hopefully it'll work. I haven't actually implemented controller inputs yet, so I can't exactly test any of this. Actually, I can kinda virtually test it, now that I think about it. I manually mimicked a disconnect by directly running the function from my debug overlay and it worked like a charm. Hopefully, when the real thing happens it'll still work.

Next Up

Now that I'm done with that little task, it's time to dive back into the quick action buttons! It took a little bit of thinking but in the end I was able to work with Gemini's suggestions and made the function my own. Originally, I had built the function to match the button id and act on each accordingly, but I had previously built out a function that negated the need. So, my new function to act on the button press now just matches the action type and will act on the specific action id. Of course, the only action at this time is to consume an item, but I have a method ready to add more when the time comes.

Next Time

Of course, I say all of this without actually testing anything. And, luckily, in testing IT WORKED! This is just amazing, first try and it just works. Sure, I got help from Gemini, but the logic and flow are all of my own design. There's still so much more to do though. I still haven't built out the function to update the look of the quick action buttons, and I don't have anything built yet to deal with depleted items. I think a simple notification when attempting to consume an item that the player is missing should suffice the start. But that's a tomorrow problem. Today is another win in the bag! Two big wins really!

Leave a comment

Log in with itch.io to leave a comment.