Site Overlay

Shadow Generation System

In the process of redoing the entire shadow generation process; originally the game would do some fairly basic trig and then end up with… a line. The thing about that is that the line was locked to the level of the ground objects, couldn’t really be bent/cut off, etc. And I hadn’t even begun to think about how it could be done on ceilings and walls… without completely redoing how the shadow was made.

So after a few days’ work, the new system is kind of presentable. For the most common case (light shining from above, no slope/walls) it works pretty much identically, but the other cases still need to be worked out (though I have notable progress on light shining from below, e.g. the shadow casts onto a ceiling).
The shadow is now represented by a series of individual pixel objects, who roughly tag along with each other to figure out their positions. These are created and destroyed as the shadow gets longer and shorter, and there are additionally two separate objects for the starting and ending pixels of the shadow (these are the green and red pixels on either end of the shadow). The starting pixel stores variables such as the shadow’s length and offset, while the ending pixel is used to determine the position of the Active Shadow.

There is also a line which is locked to the center of the light source and aims through Luna’s head, which checks for collisions with the pixels and cuts the shadow short when the pixels are raised along slopes. This part isn’t completely done yet; I’m still running into issues where the pixels make it through for one frame before being cut off. The shadow still ends up the right length after a bit, but it should cut the end off before the shadow is drawn.
Ideally I will also use this line to shift the shadow pixels over when the shadow passes over something like a cliff, since the pixels are currently locked horizontally.

Copyright © 2024 Detta's Designs. All Rights Reserved. | Catch Vogue by Catch Themes