In Halcyon, bosses are mostly just another instance of a regular enemy, just harder. There were a few differences which I'll talk about in a minute, but interestingly, those differences aren't what took me the most time with this fight. Really, the things that took the longest were bugs in my main enemy-handling code that only revealed themselves while developing the boss fight:
- The boss shoots missiles. The system for spawning a bullet for a boss had a bug based on the sign of the vertical offset. Meaning if you spawned a bullet above an enemy's reference point, it failed. (every bullet I had spawned until this point was shot downward from an enemy, so I never noticed)
- The edge-of-screen clipping was broken on the left side of the screen. Other enemies were narrow enough that I didn't notice, but enemies would disappear once about halfway off the left edge.
- My enemy animation system was broken for animations that had multiple different repeating sections
|This guy's look might change entirely once Frankengraphics gets ahold of him.|
I'm also not sure about the vertical placement of the enemy health bar. We'll see.
Once I got those things worked out, developing the things specific to bosses was pretty quick:
- I wanted a boss HP meter so you had some idea of how the fight was going. I thought this might take a while to develop, but I was able to reuse the code from the player's HP meter without much work, so this only took about 10 minutes to get working!
- Bosses need a way to stay dead once you kill them. I already had the engine infrastructure in place to persist important global game state, so I just needed to add hooks before spawning the boss, and after killing it, to read and write that game state.
- I added another entity, a type of gate, that blocks a pathway until all other enemies on the screen have been killed. This could be generally useful in other screens where I want to force a fight, but was important to make you actually stay and fight the boss.
That said, other bosses in the game might require something more complicated -- larger bosses might be made from background tiles, and require some sort of background-scrolling magic to animate them. We'll cross that bridge when we come to it.
It's almost time for another round of testing, to see what's completely broken, or if the challenge level is acceptable. If you're reading this, and are interested in helping test the game, send me a message!