How do I make tile based darkness/light?

0 favourites
  • 2 posts
From the Asset Store
Each tile 64 by 64 pixels - Ultimate Tile Set for your awesome games
  • Hello,

    I wonder how to make performance friendly tile based darkness and light.

    I have 64x64 darkness tile, which is little transparent sprite and have them cover whole layout.

    Then there are "lightsources" objects.

    So, idea is that darkness should lose opacity as it gets closer to lightsource.

    Haven't managed to get this work, and every tick solutions seems to impact performance...

    Ideas?

    Thanks.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I mean, its not that hard... I added line-of-sight for light source and if it sees darkness tile, I set its opacity

    clamp(distance(Lightsource.X, Lightsource.Y, DarknessTile.X, DarknessTile.Y), 0, 100)

    That works as long map doesn't have two lightsource, if I add one more, I think these start to conflict.

    I think I should make so that darkness only react to closest light source but can't find how.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)