Depth Arm Effect

So once again I was putting off actual gamedev work to create a simple effect I saw online. And once again this was from a post by Richard Lems. This time on his Mighty Goose Discord.
richard plz don't send laywers

The effect was using simple 2D sprites stacked on top of one another along with some depth to create a 3D like sand snake. I was so enamored with this concept I wanted to see if I could make the implementation work. I find myself doing this quite often, hopefully this will help in a game or a jam someday..

Anyway I got to work. My first thought was to just render some sprites to make a line from one position to another. Pretty simple, just pick a number of sprites, do a short calculation to figure out the distance between the starting point and the ending point along with how far in between each the sprites would need to be in order to be evenly spaced out.

This ended up going really well, I then threw a very simple depth check that just made the sprites get bigger as they approached the bottom of the screen.

Boom! Easy! But it wasn't quite what I had wanted. There was no bend to the sprites which left them without and life or vibrance.

I then had the idea of finding an elbow point. With some help from my friend Mazz, I was able to get a decent elbow point. This lead to a slightly more dynamic look but it was still very stiff (unfortunately I did not grab a gif of this). What I wanted was a curve, a Bezier curve would actually solve my issues! The calculation I had for the "elbow" before could now be the control point in the bezier! I first set both control points in the cubic bezier to the "elbow" but then realized I wanted more of an up then down shape so I adjusted the first control point to be just vertical and not move on X. Plus Nez already had helper functions to get this Bezier to work!

I'm quite happy with the result! I ended up playing with the concept for a bit and creating a creepy actual 3D looking monster.

As always with my effect tests you can check out the code for my effect projects on Github. Or if you just want to look at the specific file for the DepthArmComponent check here.

Andrew Napierkowski

Professional Software Engineer | Hobbyist Game Developer