Last week I got back from my spring break trip and started Wolverine Soft development again! Let's get started!
As usual, we had our weekly studio meeting. However, there was only 1 in the past 2 weeks because of Spring break.
This week I was tasked with implementing a couple new attacks for the boss to use. These attacks were a little trickier to implement than the previous ones since they had some unique behavior.
The first was the balls of fire attack, where the boss fires 12 projectiles which rotate in a shrinking circle around the boss room.
This attack required me to do some trigonometry to figure out where the projectiles should go. The challenge is figuring out how the projectiles should be spawned at the boss's then move seamlessly into the circle. What I did to solve this issue was place a script on each of the balls of fire. This script would be initialized when the projectile is spawned, and calculate the desired location every fixed update. The velocity of the projectile would then be set such that it would approach this desired location, leading to a smooth beginning to the attack.
The second attack was a rain of projectiles attack. In this attack, the boss will rapidly spawn projectiles which drop down from the ceiling of the boss room.
In theory, this attack shouldn't be too difficult to implement, since it would just involve spawning random projectiles along a line. The challenge is figuring out how to conform the attack to the dimensions of the boss room. Thankfully, the level programmers had the foresight to put a collider on every room. This means that I can grab the extents of the collider and use that to figure out the coordinates of the ceiling.
Another characteristic of the boss is its mode. These are modifiers randomly placed on the boss which modify its attacks
Before creating any modes, I wanted to establish a system that used composition and polymorphism. To do this, I created an abstract "Boss Mode" class which had several unimplimented functions. A new mode would then implement this class. The mode could then be added to the boss's components and its effects would be automatically applied. This approach makes the implication a bit trickier, but it simplifies the process greatly for other programmers since they can simply put the mode on the boss and it will just work.
The first and only mode I worked on this week was the explosive attack mode. This mode modifies all of the projectiles fired by the boss to become explosive. Thanks to the projectile system that I had already developed this change was as simple as changing a checkbox in a scriptable object.
The one bit of complexity was that the explosion had to trigger whenever a bouncy projectile bounced. To do this, I created an onDeath event on projectiles. The bouncy projectile would then invoke the onDeath event, spawning an explosion.
In total I spent 12 hours on studio work this week.