Creating Lights

Important

Remember to initialize the engine first.

Setup a light

Let's add a new object. We'll call it obj_light. Create a new sprite for your obj_light (e.g. spr_light).

We'll use the following function to set up a light. glr_light_create(sprite, subimg, x, y,color, intensity);

Then we have to use a sprite to define the shape and the gradient of the light .
Let's use this batman light mask with the origin to the center
Batman Light Mask

Create Event

In the create event of obj_light we create a new light my_light = glr_light_create(spr_mask_batman, 0, x, y, c_white, 0);`

Note: The last parameter is intensity. This is available only if are using the Additive Rendering mode with glr_draw_gamma(application_surface); in the Post Draw Event
Just leave this value at 0 or you will get a very bright light.

Room

Now, put some obj_light in a room and run the game.

Static lights

If you have static objects and lights in your room, glare can optimize them. Static lights should not be moved but are way faster since they render the static shadows only once. Add this line to set a light as static glr_light_set_static(my_light, true);

Note: If you need to move a static light, it's possible to refresh it after the repositioning with glr_light_refresh(my_light);