I have been playing around with different techniques on producing dynamic shadows. The first method I tried was the canvas plugin, which works amazingly, but seems lack in performance when you begin adding more elements and events.
I also read Rory's way of using a shadow sprite pinned to a caster object and setting its angle opposite to that of the player. I implemented this along with changing the size of the shadow based on a instance variable I place on the player called "shadowRange". Using some lerp & *dt I can change the size depending on the range (position) of the player. This works, but lacks the true responsiveness based on the players position due to the static nature of the instance variable.
I imagine there is a way to "lerp" the players distance in relation to the shadows position to change it's size... If that makes sense.
I have mocked up a little demo of what I was able to accomplish.. Shadows
Any pointers would be greatly appreciated.
<font color="red">EDIT:</font> I updated the file. I figured out how to do it, after realizing I answered my own question. With a little tweaking I think that could work out nicely as a way to produce dynamic looking shadows.
Will update as I work on it further.
Develop games in your browser. Powerful, performant & highly capable.