Challenge Mode Challenges

I *almost* finished roughing in the unlockable characters this week. Almost!! I really underestimated how much work it would be! For now, I’ll talk about a few of the hurdles in creating Challenge Mode instead.

I mentioned Challenge Mode a few weeks ago — it’s the one where you can fight up to three bosses at once! In general, it was really easy to implement because of how I code my boss fights! Every boss in Bleed 2 is fought inside an “arena”, which is just a rectangular area of the level that I mark off in code. It’s a habit I got into during Bleed 1 when I designed its Challenge Mode.

Bosses use the rectangle in all of their behaviour. For example: if a boss has an attack where it rushes across the screen, it knows the attack is over once it’s outside the arena boundaries. Using the boundaries, it also knows where to reappear. If I want a boss to move to the center of the arena, I just tell it to move to the point halfway between the arena boundaries. Etc etc. When Challenge Mode starts, I just create a bunch of bosses and give them the level’s arena rectangle. It’s pretty easy!

But.

But, it would be boring if all arenas were perfect rectangles — so they aren’t. Still, in code, the “arena” has to be marked off by a rectangle, which led to some issues.

For example, the Blast Jumper ignores all tile collisions — the only “ground” it knows is the bottom of the arena rectangle. Now that it can be fought in more varied arenas, I had to change how it handled collision detection.

Now a ray (yellow in the picture, I know it’s small) is shot from each of the Blast Jumper’s feet, looking for tile collisions. The highest collision it finds is the new “floor”! If that value is lower than the arena floor (the lowest pink line), the arena floor is used instead. Voila!

That’s just one of the many small issues that arose. Another quick one would be how elements interact with large reflected bullets.

All entities have a flag letting them know if they block those big reflected bullets. The Chaff Spammer fight doesn’t use any big bullets, so I never had to pay attention to that flag for any of its elements. Things got messed up once big bullets were introduced, but it was an easy fix. I went through all the bosses and set their flags appropriately… I think I got them all!

So there you have it! This week I’ll deliver the finishing blow to unlockable characters and start working on cheevos!