Monday, October 23, 2023

In-Combat Touch-To-Select Working



I've been trying to work out a lot around combat currently, and one of the things I was just getting to was "How do I nicely display buffs/debuffs on creatures?" Characters showed up easily enough with the HUD on the screen, whether it was in combat or non-combat mode. But as I've been halfway through getting abilities working, I started being able to apply character abilities to creatures - and of course, the player needs to be able to see that somehow - hopefully easily.

So, I went to my brains-trust of friends, who put up with me asking random stuff like this all the time, and they delivered. Nath called out the obvious "What do I see when I click/touch the creature on the screen?" "Nothing, I haven't coded anything for that" I replied. I'd looked, way back in the early days of this code, into capturing screen touch effects and using some android touch-bounds and connecting them to things... and it was HORRID. So, I changed course and modified my code to allow me to simply capture the direction of the touch event compared to the player, which worked MUCH better for movement, and put in the button that pops up when there's something to do. That's working a charm, but... as Nath pointed out nicely, there's a need for different things in different places. When I'm in combat, I'm not needing to capture the movement like I am otherwise, so there's a brilliant UI method going to waste.

So, some hastily written code, that worked surprisingly well for what I wanted, and I've now got nice captures of screen touches in combat that will bring up a simple info panel of the monster touched, along with what it is, health, action and mana bars, and.... wait for it... buffs and debuffs that the creature has.

This will also work really nicely, for the thing I was about to do - and do badly, which is selecting targets, for either ranged attacks or abilities that target a location rather than a creature. Without the "touch to target" concept, it was going to be awful from a UI point of view - so thanks to Nath, I've gone about it the right way, the way it should have been done all day long.

 

 

 

No comments:

Post a Comment

Character and Item Stats

It feels like I've renamed a thousand thousand properties in classes, updated a myriad of methods across the database, the editor and th...