Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(3 edits)

Suzieus also has some interesting collision testing logic in it [Javascript in our case, not Unity or Godot]. The bosses are big and have a lot of animations that change shape and size, and we learned from a previous attempt in this genre (https://goodbunnystudio.itch.io/suzie-demo) that fighting a big boss where the hitbox isn't related to its drawn shape and size is counterintuitive. We needed to make the boss hit detection match with the animation frames, and we had a lot of animation frames to do that with.

Instead of giving the bosses geometric hitboxes at all, we decided to take a hitscan-like approach. The alpha channel of the boss's actual sprite is what tells us which parts are collidable, at pixel precision. Since the boss is constantly scaling and rotating, without any optimizations we'd need to compute an entirely new alpha mask to test against every frame, and that would be slow using the Javascript 2D canvas API. Instead, for each stop-motion frame from the spritesheet we store the alpha mask just once, and we apply the inverse of the boss's position, scaling, and rotation to the bullet so we can test against the same mask over and over using a "boss-relative" coordinate no matter what transform we're applying to the boss's sprite.

(If we were using an API with more direct access to the GPU, we probably wouldn't have needed to use the optimization, but the game would have taken more time to code. The 2D canvas API is very convenient for making quick 2D games.)