Click to Play!

Monday, May 26, 2014

Restructuring Spell Code


    It was a thought in the back of my mind but the consequences are coming up. I coded the spells' stats inefficiently by making them all share a single set of variables that change every time you switch. This allows a glitch like this: shoot a blast spell, switch to pyre as it's flying, blast does pyre damage. So instead of that mess I made it so each spell keeps track of it's own stuff when it's created.

     I use a few arrays (boxes where I can manage sets of data) now instead of variables. Those arrays switch spots when spell slots do and this way I'll have something constantly keeping track of which spell has which stats and upgrades. Now the spells can figure out how much damage they're supposed to do when they pop into the world.

No comments:

Post a Comment