Characters can now cast spells in battle!
In order to get spell casting to work, I had to lay the groundwork with a few lower level systems:
- Characters had to be able to ‘learn’ spells at certain levels. I created an array of
ClassSpell
objects on each class, each containing a required level to cast in addition to a reference to aSpell
object. Spell
objects hold all the data associated with a spell (MP required, potency, casting type, targeting type, etc) in addition to a reference to ananimationEffect
. AnanimationEffect
is essentially an object with aplay
method, which handles playing an animation I created using Phaser’s tweening and animation API.- I tie it all together in a
SpellController
which handles getting a spell from the database, its related effect, and mapping that data to an actual usable object.
It all essentially looks like this:
And in practice, it looks like this!
Since the effects are stored decoupled from the spells, I’ve also got AnimationEffects
associated with items, so using different kinds of items will also trigger similar animations and sounds.
I’m really looking forward to making some cool spells and effects. On the docket for the foreseeable future, I’m going to be working on:
- Targeting improvement
- Spells that target multiple enemies or allies
- Spells that add status effects or attribute enhancing effects