William Garrison
Member
I just followed a tutorial on lights and finally got one that works with my system and current GMS. Great BYT for some reason my lights are cutting into each other. The gentleman in the video doesn't seem to have that issue as far as I can tell. I have double checked the code and cant find anything wrong. Im hoping someone here can show me how to fix.
Here is the tutorial I followed to get here.
Below is my code...
CREATE
DRAW
Inside of the light itself I only have 4 variables set up...
Color, intensity, wobble and thisXY
Here is the tutorial I followed to get here.
Below is my code...
CREATE
GML:
lighting_surface = -1;
GML:
// if no surface exists, draw one
if (surface_exists(lighting_surface) == false) {
lighting_surface = surface_create(room_width, room_height);
}
surface_set_target(lighting_surface); // set the surface
draw_clear_alpha(c_black, 0.33); // darken the room
// create and blend the light
with(oLight) {
var wob_am_x = image_xscale + random_range(-wobble, wobble);
var wob_am_y = image_yscale + random_range(-wobble, wobble);
// draw and cutout the sprite
gpu_set_blendmode(bm_subtract);
draw_sprite_ext(sprite_index, image_index, thisXY.x, thisXY.y, wob_am_x, wob_am_y, 0, c_white, 1);
// color and intensity alterations in the room editor
gpu_set_blendmode(bm_add);
draw_sprite_ext(sprite_index, image_index, thisXY.x, thisXY.y, wob_am_x, wob_am_y, 0, color, intensity);
gpu_set_blendmode(bm_normal); // reset blendmode
}
surface_reset_target(); // reset the surface
draw_surface(lighting_surface, 0 , 0); // draw the surface to screen
Color, intensity, wobble and thisXY