Tuesday, September 2, 2014

Dynamic 2D light

Since I have no AI that could use line of sight, I revisited my old dynamic light code(which was used to make line of sight in the first place), and replaced it with the line of sight stuff. It inherits a sensor class which keeps track of objects inside it, and then calculates the shadows/final light shape for rendering. You may notice lights are rendered with additive blending.

If you look at the health packs you will see this methods flaw. It is vertex based, so if a texture has transparent areas, you can see obvious gaps.

It also currently only supports convex shapes, and I would like to make light outlines on the sprites that the light hits.

No comments:

Post a Comment