Reversus
Introduction
Reversus is a 2D multiplayer shooter currently in the early stages of development. Players face off in a an arena where nearly everything can be destroyed.
My Work
Enemy AI
I developed a per-pixel collision system to ensure collisions between the golf ball and obstacles were semi-realistic when hitting edges, corners, or angled walls. MonoGame has built-in functionality for rectangular collisions already, so I used that as my primary collision detection. If a collision occurs between two rectangles, we check each pixel inside the overlapping area to see if both sprites have a non-transparent color. After all overlapping pixels have been checked, we average the positions of the colliding pixels to get a central point for the collision. Next we compute the normal vector by getting the vector from the collision center to the ball’s center, then reflect the ball’s velocity across that normal.
Skin Swap Shader
I wanted the golf ball to have a rolling animation, but I needed it to “roll” in the direction the ball is moving while maintaining visual continuity. To achieve this, I made a pixel art sprite sheet in Aseprite that covers every possible divot placement. The sprites were organized in a rectangle so that every sprite is one pixel position off from its neighbors. This allows me to track the distance traveled on both axes and once the ball covers enough distance to constitute a roll, swap the current sprite with its neighboring sprite corresponding to the velocity direction.