I have a lighting system using surfaces… I am using a sprite that creates the light. I have a surface that covers the whole room with a dark tint. Then I create a hole in the surface, and draw the sprite in it instead. The sprite for the light is a white color, and I want to use this light to support multiple colors.
Is there a way in the sprite editor to change the image blend? or can I do it in the code. Keep in mind, I’m not creating an object for the light, I’m drawing it, I tried using draw_sprite_ext() and doing c_aqua for the color, but the light is still white.
This is the code for the object oInit, which has no sprite, and is placed in the room.
Here’s the code for Step event: (note, i am using image_xscale for the size because I am determining that in the code above this that you cant see, the light is growing and shrinking but I didnt include that code here… just ignore it for now cuz the code works fine, just wanna change the color)
surface_set_target(surf);
draw_set_color(c_black);
draw_set_alpha(0.8);
draw_rectangle(0, 0, room_width, room_height, 0);
draw_set_alpha(1);
if (instance_exists(oPlayer)) {
gpu_set_blendmode(bm_subtract);
draw_sprite_ext(sLight, 0, oPlayer.x, oPlayer.y, image_xscale, image_yscale, 0, c_aqua, 0.8);
gpu_set_blendmode(bm_normal);
}
surface_reset_target()
Here’s the Create event:
// Surfaces for lighting
surf = surface_create(room_width, room_height);
surface_set_target(surf);
draw_clear_alpha(c_black, 0);
surface_reset_target();
Here’s the Draw event:
if (surface_exists(surf))
{
draw_surface(surf, 0, 0);
}