How do I make a dynamic lightning system?

Get help using Construct 2

Post » Wed Jul 20, 2016 4:17 am

How can I make a dynamic lightning system for a sandbox game ?
I want to make something like Terraria :

Image

I use a tilemap and I tried a lot of thing but I still have problem with performance.

If someone can help me .. Thanks :roll:
My Twitter:

@Sirvoidd

My Tutorial:

Multiplayer with Photon
B
32
S
12
G
9
Posts: 73
Reputation: 7,069

Post » Wed Jul 20, 2016 9:40 pm

Dynamic lightning is always more difficult than it seems at first, you need skills on programming.

I´m not sure how to achieve this, but, what about setting an array with black tiles, and then, turn their opacity by checking distance to player.
A simple grid that can not only check distance to player but also check if its another object in it, for example, dirt or water or nothing, so you can turn the opacity in order of qhat is colliding
B
5
S
1
Posts: 28
Reputation: 433

Post » Thu Jul 21, 2016 12:32 am

You could indeed use a black tilemap on top that is exactly the same size as the viewport - and scrolls with the viewport itself. Then use math to figure out where you're at on the layout and turn the black tiles "on and off" accordingly based on your light position.

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
81
S
34
G
40
Posts: 3,031
Reputation: 30,422

Post » Thu Jul 21, 2016 6:39 am

Not sure if you've seen this but you might want to check this tutorial out.

https://www.youtube.com/watch?v=L1dd4fkVSAM

It's not what your looking for but it could help.
B
28
S
14
G
21
Posts: 179
Reputation: 13,548


Return to How do I....?

Who is online

Users browsing this forum: bluesun66, plinkie and 3 guests