GMS 2 Lighting and Shadows



Evening all,

I have just finished the YoYo lighting blog ( and have everything working as explained. I have made a couple of changes but I have one thing I want to amend but I am struggling with and I hope the community can help!

Basically I want to have everything outside of the light be in the shadow. The blog goes from no tiles shown at all to all tiles being out of the shadow, regardless. The code added to make this change is:

    if( !SignTest( px1,py1, px2,py1, lx,ly) ){
        ProjectShadow(VBuffer,  px1,py1, px2,py1, lx,ly );
    if( !SignTest( px2,py1, px2,py2, lx,ly) ){
        ProjectShadow(VBuffer,  px2,py1, px2,py2, lx,ly );
    if( !SignTest( px2,py2, px1,py2, lx,ly) ){
        ProjectShadow(VBuffer,  px2,py2, px1,py2, lx,ly );
    if( !SignTest( px1,py2, px1,py1, lx,ly) ){
        ProjectShadow(VBuffer,  px1,py2, px1,py1, lx,ly );                     
/// @description which side of a line is the point on.
/// @param Ax
/// @param Ay
/// @param Bx
/// @param By
/// @param Lx
/// @param Ly

var _Ax = argument0;
var _Ay = argument1;
var _Bx = argument2;
var _By = argument3;
var _Lx = argument4;
var _Ly = argument5;

return ((_Bx - _Ax) * (_Ly - _Ay) - (_By - _Ay) * (_Lx - _Ax));
If I move the light object above the tilemap then the tiles arent shown at all, even when next to the light.

I am not very sure about any of this so apologies if I am talking gibberish.

Any advice would be great!