D
DigitalCaffeine
Guest
I took a small break from working on my game when I did some traveling over the summer, and when I opened it for the first time in a month, the surface I'm using to draw lighting on is semi-broken. When the room starts, everything is in the correct place, but when I start walking to the right and the view moves, the surface the lights are being drawn on suddenly start moving to the left. When the character walks left again and I return the view to it's initial position, everything is correct again. Everything was working perfectly fine a month ago, and after changing nothing it's now all messed up. Did an update happen that changed the way surfaces work or is there something else that could be causing this? I make backups of the project every couple of weeks and this is now broken in old versions too when I KNOW it was fine.
What the problem looks like: https://imgur.com/a/VTagv1c
When it was working fine: https://imgur.com/4vzswin
Create Event:
light_layer = layer_get_id("Lights");
light_surface = surface_create(400,240);
layer_script_begin(light_layer,lights_begin);
layer_script_end(light_layer,lights_end);
When the script for layer_surface_begin is called:
if (event_type == ev_draw) and (event_number == 0)
{
if (!surface_exists(iLight.light_surface))
{
iLight.light_surface = surface_create(400,240);
}
var cam = view_camera[view_current];
surface_set_target(iLight.light_surface);
camera_apply(cam);
draw_clear_alpha(col,1.0);
gpu_set_blendmode(bm_add);
}
What the problem looks like: https://imgur.com/a/VTagv1c
When it was working fine: https://imgur.com/4vzswin
Create Event:
light_layer = layer_get_id("Lights");
light_surface = surface_create(400,240);
layer_script_begin(light_layer,lights_begin);
layer_script_end(light_layer,lights_end);
When the script for layer_surface_begin is called:
if (event_type == ev_draw) and (event_number == 0)
{
if (!surface_exists(iLight.light_surface))
{
iLight.light_surface = surface_create(400,240);
}
var cam = view_camera[view_current];
surface_set_target(iLight.light_surface);
camera_apply(cam);
draw_clear_alpha(col,1.0);
gpu_set_blendmode(bm_add);
}
Last edited by a moderator: