0 Favourites

Player position based (dynamic) shadows

  • 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.

    Thanks,

    Chris

    <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.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
0 Favourites
[plugin] Youtube player
175 20,534
rexrainbow's avatar
rexrainbow
Unread hot topic
107 13,188
LeuNoeleeste's avatar
LeuNoeleeste
Unread hot topic
74 8,083
eli0s's avatar
eli0s