Lighting Amount
There re some useful functions to get the lighting level on a certain point.
The first step is to update the buffer with
glr_get_illumination_update();
Then you can get the lighting value with
glr_get_illumination(x, y);
note
x
and y
are relative to the view
Usage Example
//retrive information about illumination (use only once per frame)
glr_get_illumination_update();
//Player coordinates in screen space
var px = obj_player.x - camera_get_view_x(view_camera[0]);
var py = obj_player.y - camera_get_view_y(view_camera[0]);
var illum = 0;
//Get illumination around the player (5 points)
illum += glr_get_illumination(px, py);
illum += glr_get_illumination(px-16, py-16);
illum += glr_get_illumination(px+16, py-16);
illum += glr_get_illumination(px+16, py+16);
illum += glr_get_illumination(px-16, py+16);
illum /= 5; //mean value
return illum;