2D Game Dev Journey — Day 27: Boss

Gabe Gomez
3 min readJun 4, 2021

Welcome to 2D Game Dev Journey — Day 27: Boss. Today I go over how I implemented the final wave of the game, which is the player going against the boss.

Starting Point & Setup

Today we will be starting right where we left off in 2D Game Dev Journey — Day 26: Wave System and Balanced Spawning.

To get started for today, I went ahead and created a boss sprite. Below is the result of what I created for this game’s business.

Boss Implementation

To create the boss, the first thing I did was inherit the base Enemy class, as I did with all my other enemy types. With that done, I then added a new virtual method to our base enemy class called TakeDamage() to support our boss having its own health.

As can be seen, this code changes the fill amount of a variable called _healthBar, which is the user interface image I created to visualize our boss’s health.

Another thing about our boss is that they are to stay on the screen at all times, unlike all previous enemies which fell off the bottom and came back on the top. On top of that, our boss also has two methods of firing. One way is a laser that is shot out whenever the player passes over the white circles. The other firing mode is the boss’s five-pronged laser. After implementing everything I needed to for the boss, this is how it came out:

As can be seen, we got pretty lucky getting the homing missiles there, otherwise, this definitely would have taken a bit longer. Even so, this is our boss in-game, and I am quite happy with it.

Conclusion

Thanks for checking in and reading today’s article. In the next article, I will be polishing up certain aspects of the game to make it more balanced and challenging. If I have made any mistakes, please let me know so I can correct them for future readers. If you would like a more in-depth tutorial about anything I went over today, let me know and I will take the time to write something up.

--

--