Cave Run is a 2D platformer designed to be played on a fictional handheld device with the graphical color range of the original Game Boy and the restriction of only three buttons: a left arrow, a right arrow, and an action button. This game is focused around the central mechanic of fluidly switching between the foreground and background, triggered by pressing left and right simultaneously.
Programmed all aspects of the game using C# and Unity, including the fore/background switching and enemy behavior.
Designed and assembled all three levels in the game, utilizing the central mechanic in fun, thought-provoking ways without confusing the player.
Playtested intensely to ensure smooth depth-switching while avoiding collisions between the foreground and background.
Creating the "depth switch" mechanic was certainly where I had the most fun when developing Cave Run. Getting the background to look right was simple enough, in Unity I simply had to place it further along the Z-axis to visualize depth, but having the player physically jump between it and the foreground was where challenges arose. The key rule of the mechanic was that the player could depth switch only when the target layer contained no obstacles (walls, etc.), requiring a collision check before activation. At the same time, 2D collision in Unity logically doesn't factor in the third axis, and with a healthy use of Unity's layer system the fore and background should never collide. But, with those rules in place, how would the player character collide with the opposite layer to check if depth switching was possible?
My final solution was to create two player characters bound permanently to their assigned layers, with the inactive character using their hitbox to check if their layer had a clear space for the active character to perform a depth switch. In hindsight, with a better understanding of Unity's collision system, I realize it would've been far easier to run a box trace in the desired layer to achieve the same result, but at the time this was an effective solution that allowed me to bring my idea to life.