Alright, let's just...quickly blast away some of those bugs. Bug squashing is satisfying but also tedious. I find it interesting, as I still don't know a TON about how like...code works. So I tend to learn a lot along the way.
For instance, the enemy and player teams were duplicate()ed when the battlescene started. This, for some reason, didn't do what I wanted - as in - the player and enemy mons would retain their health between combats. What was happening here was that duplicate was duplicating the array. And ONLY the array - not the contents. So, to fix this, we have to iterate over the enemy and player teams, specifically duplicating their mons' stats from the singleton's stats.
Squashed.
Controls are easy too: This keyboard is different than the last one I used. You can see the old input there above "up". I decided to leave those alternative binds in there - in case it's a common thing.
(big, click to biggerer)
Going off what mightymushroom mentioned, the log needs an upgrade. I've been meaning to do this for a bit and think it'll be pretty easy. So let's do it.
First, new function:
Godot's RichTextLabel (what we use for the log) support BBCode! That's the same as this forum! And heck, I'm always on this forum.
For example:
All I did here was send the last lines of combat between turns to this function - they pass everything they print into "text" which we then can surround by bbcode tags.
So now, you see txtout has a few more arguments. text will always be whatever we want to print to the log. For how long will naturally be 0 (so it'll only wait a bit if we ask it to) Likewise, it'll always be black unless we say otherwise.
Then we yield for "time" and move on! Great!
This print chain is quite long, so here's just the end of it - you can see that, because the arguments are pre-set, they're optional.
The result is exactly as expected! (jpegs don't like green, apparently. It looks fine normally.)
Interestingly, Godot won't throw errors if the color isn't recognized by their BBCode handler. For example:
Will just print:
Except...
Why didn't the new line get started?
So, yield is...picky. Because this print is called twice in a row (for player and enemy health+status) it process the first one, starts the yield, but immediately starts the second one, overwriting the yield. This is exactly not its purpose, and also completely ignores what we're trying to do. I have a simple solution:
Now, because there is more code after the yield, it'll wait and do it, I guess? It's dumb.
I asked in a matrix group for some tips and people suggested checking if the timer has gone out before doing the next line. I'll see how easy it is to put that to code. Either way, what I have to do next is replace every time I print to the log with this function. This is just a bit of work, but something I'll need to be meticulous with to avoid any errors. I'll probably add another argument too for things like
bold and
size.