Devlog 2024-01-28

This week I got started on a big important chunk of work – the final boss of the game – and fell prey to one of the classic bugbears of game devs: trigonometry.


  • Evil Island: Started the final boss
  • Evil Island: Some some small polish stuff

The Final Boss

As I mentioned last week, I split the “last level” and the final boss fight into two because of the structure of the game. The final boss is, fittingly the CEO of Evil Corp.

I want a boss fight that is interesting without being too overtly hard, and doesn’t rely on completely novel mechanics in the game. I got… most of the way there, but I ended up adding some shootable batteries; they power his forcefield and all four of them must be destroyed before you can shoot him. Getting to the batteries involves flipping some levers to gain access to them, and so on. While all of this is going on, he’s firing mortars at you (and more on that below…)

It’s pretty standard platformer boss stuff, specifically the kind of platformers I’m paying homage to – and not the Castlevania/Metroid style bosses with tons of health and attack patterns etc. Ultimately, the boss is designed more as a level than as “just an enemy”, and I couldn’t really just drop him in to some other level and have it work. I’m pretty happy with how it’s shaping up, but I still have a way to go!


Since I decided I wanted to re-use the mortars I have in other parts of the game, I needed to get them firing in a way that was actually dangerous to the player. Before the CEO, they were all fired out of cannons at a fixed angle; this is very easy to create and very predictable to the player. Which is fine for how they’re used in other levels, but for the boss fight it seemed a little… static to just have them always fire at exactly the same spots in the map. (In fact, I toyed with the idea of just having cannons instead of making the boss fire them himself!)

Now, flying objects are very easy when you want to give something an initial velocity and direction and just simulate their movement – each frame you update their velocity based on acceleration (including gravity!) and then update their position based on velocity. Simple! That’s exactly how the mortar cannons work, and how the mortars work once fired. The trick with the CEO, though, is that I want him to fire those mortars at the player. I want to use a fixed velocity for the mortars, and I have the position of the player and the CEO, so all I need is to figure out the angle of firing! Unfortunately this turned out to be a lot more than my tired weekend-brain was up to. In my defense, it’s been a very long time since I took beginner physics.

After scribbling for a while drawing little graphs and writing bits of equations and erasing them to write different bits of equations, I finally… just looked it up like I should have done to begin with. If you were hoping to read a bunch of diagrams and code about how to do the ballistics calculation, you should just go check out this blog post instead:

It walks through the ways you can do it, and the section titled “Firing Angle to Hit Stationary Target” ended up working exactly how I wanted (… once I figured out how to get it working in my code). The sample code is in C#, but should be pretty readable for anyone who is using something else. Sadly, the blog also hosted all of its sample gifs on gfycat, which is no longer, but I found the explanations to be enough (hopefully you will too!)

Next Week

I’m hoping to finish up the boss fight by next weekend, and then next on my plate is to do the first level. I also have some miscellaneous bits of polish and some art to draw… I might do some of that? After I finish the boss fight, anyway.