V
Vanthex
Guest
HI guys,
This is my script that I use to determine how dark a block should be, here is the result:
However this only works along the Y axis, where basically the light is only casted downwards, so if I go straight down I would end up like this:
The blocks on the sides are not lit up.
So I want the light source to be able to affect blocks that are next to each other, this is my code and I don't know how to incorporate that into it. (I'm new to coding)
This just returns an alpha value for how dark it is going to draw the block.
This is my script that I use to determine how dark a block should be, here is the result:
However this only works along the Y axis, where basically the light is only casted downwards, so if I go straight down I would end up like this:
The blocks on the sides are not lit up.
So I want the light source to be able to affect blocks that are next to each other, this is my code and I don't know how to incorporate that into it. (I'm new to coding)
Code:
var a = 0;
for (var i = 1; i <= 4; i++) {
if (place_meeting(x, y - (sprite_height * i), obj_tile)) {
a += 1;
}
}
if (a > 0) {
a = (a * 25) / 100;
}
return a;