Development Blog‎ > ‎

Sword Damage Types

posted Jan 11, 2012, 3:34 PM by Mavrik Games
I managed to get a damage type class set up for each sword, so now there's Wind, Fire, Ice and Lightning damage types. They each have three levels of effects that can fire off depending on the charge level of the sword. I set up damage over time functions and a function to damage the pawn from falling (useful for damage types that launch the enemy into the air). I also set up a function to handle knockback from the different swords. My idea is to make the heavier swords (ice and lightning) stun the enemy a little. This should help balance the swords and still give them a little more diversity. Right now, I just have it set to add some velocity to the enemy in the direction of the sword strike, but eventually I'll throw in some animations showing the enemy stumble a little.

It was actually a lot of work trying to set up four different classes and trying to maintain some semblance of good software architecture principles. The damage types were all similar to each other, but in different ways. For example, I wanted the wind damage type to launch the enemies back - kind of like a shock wave. I wanted the lightning and fire damage types to have this effect too, but only on the level three charge, simulating thunder and an explosion respectively. Then there was damage over time. The lightning, fire, and ice damage types handled the actual DoT exactly the same, except I wanted different side effects for each.

I ended up creating another abstract damage type class for those three to extend, and added a function declaration to do their own side effects. I added a function to the damage type class that they all inherited from to cause a radial impulse wave, which the sub classes can call whenever they need it individually. It was really messy for a while, but after a few hours of re-factoring, I think I managed to clean it up quite nicely.
Comments