hi everyone, i'm coding a minecraft in 2D but I'm stuck on something. In Minecraft, there are 16 levels of light, determined by an integer ranging from 0 (the minimum) to 15 (the maximum). The game uses the light level of a given block to calculate its brightness.
If a block's light level is 0, it will be close to black. If its light level is 15, a white block will be close to white and a red block will be red.
Now my problem is that I don't know how to add this effect to my game. Here is what it looks like
The highest block would have to be at a brightness of 15 and we would remove 1 as we go down. I should also be able to create blocks that emit light in all directions
I created a family of objects for my blocks with a brightness effect.
Thank you to everyone who will try to help me!