Papa Doge
Member
I'm attempting to add a simple light effect to my game where certain objects have a light radius around them when the world is dark. I have the surface drawing correctly with the dark overlay but my light punch outs don't seem to be working.
I've create an object called obj_lighting_render to do this and place it on a separate Lighting layer:
I have a parent object for lights that I'd like to add my player object to along with some other objects at some point, but since nothing is working I was testing to see if I could even draw a white circle around the player and it's not working. Any ideas what I might be doing wrong here?
I've create an object called obj_lighting_render to do this and place it on a separate Lighting layer:
Code:
/// CREATE EVENT
/* -------------------- */
lighting_surface = -1;
cw = camera_get_view_width(view_camera[0]);
ch = camera_get_view_height(view_camera[0]);
depth = -999999; // I had to do this because my room objects have a depth of -bbox_bottom and where floating above the overlay
Code:
/// DRAW
/* -------------------- */
if (!surface_exists(lighting_surface)) {
lighting_surface = surface_create(cw, ch);
}
// Set the surface we want to draw on
surface_set_target(lighting_surface);
// Paint this surface black with some transparency
draw_clear_alpha(c_black, 0.8);
gpu_set_blendmode(bm_subtract);
// Draw the punch out for the player
draw_circle_color(obj_player_suit.x, obj_player_suit.y, 64, c_white, c_white, false);
gpu_set_blendmode(bm_normal);
// Reset to the application surface
surface_reset_target();
// With the application surface reset, let's draw that lights surface over it
var cx = camera_get_view_x(view_camera[0]);
var cy = camera_get_view_y(view_camera[0]);
draw_surface(lighting_surface, cx, cy);