Spells are now functional in-game during battle. Global warming made things a little more difficult (how do people think in all this heat?), but wow if it doesn't work. Visual and audio polish are still necessary to give the player proper feedback, but it's important to put functionality first.
Click 'Read more' to read more about spells!
Not So Secret
If you've read the last blogpost, you already know most of what's going on. An object gets spawned, which activates itself to handle the spell inputs. After they're done, it looks up the BattleHandler object to handle damage calculation and to move to the next turn.
That's... really all there's to it. The big issue this week was getting this to work for every type of spell. As you can see in the video, some spells don't damage opponents: they can buff a single player character, all player characters, or heal them. Some spells also target all enemies, instead of just one.
Since every spell is a separate object, this was pretty simple, albeit a lengthy process.
If the spell is a buff:
If the spell is not a buff:
Damage calculation for each is pretty simple as well:
Character's Magic stat * SpellModifier.
(Character's Magic stat * SpellModifier) - Target's Resistance stat.
So if all of this is pretty simple... Why did it take so long?
The reason is the amount of spells and myriad of different effects. All of them needed testing to ensure they worked properly, and with each different kind of spell there would be a new problem. Making sure that everything is applied correctly and functional prevents having to go back and fix it later.
Also shown in the video are the new damage numbers. They now spawn clones, rather than moving a single object around the screen. This allows damage numbers for multi-targetting spells.
The numbers also change form when buffing stats, or healing. Red is damage dealt, green is a buff. There's also a little icon showing which stat gets buffed. Healing doesn't have an icon, but it's already reflected in the player's UI.
I also spent the week doing animations and other graphic flourish. I like to code in the mornings and draw during the afternoon and evening. There's a lot more drawing to be done than programming, after all.
Next week I want to work on the platforming mechanics. Playtesting showed that regular jumping wasn't as fun as it could be, so I'm going to implement a Mario 64-style double and triple jump. I'm also going to raise the height for walljumping, and change up the level design to reflect Viola's new abilities, and better aim the player towards different paths they can take. I also want to balance the player stats to make the battles more difficult, and make level-ups more impactful.