• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM Surface lightning problem

G

graviax

Guest
So I used an old code I "made" to make a lightning effect using surfaces, but it doesn't work anymore...
It does not crash, but it just doesn't want to draw anything on my surface
here's the code

obj_lightning's create event :
Code:
depth = -100;
global.light = surface_create(view_wview,view_hview);
obj_lightning's step event :
Code:
if(surface_exists(global.light)== 0)
{
    global.light = surface_create(view_wview,view_hview);
}
surface_set_target(global.light);
draw_set_color(make_color_rgb(230,230,230));
draw_rectangle(0,0,view_wview,view_hview,false);
surface_reset_target();
obj_lightning's draw event :
Code:
draw_set_blend_mode(bm_subtract);
draw_surface(global.light,view_xview,view_yview);
draw_set_blend_mode(bm_normal);

obj_light's end_step event :
Code:
draw_set_blend_mode(bm_subtract);
surface_set_target(global.light);
draw_set_circle_precision(4);
draw_circle(x,y,size/2,color1,color2,false);
surface_reset_target();
draw_set_blend_mode(bm_normal);
Thanks for your responses.
Sorry in advance for my grammar mistakes.
 
G

graviax

Guest
All drawing must be done in the draw event.
doesn't work...
Problem is I copy pasted this code out of my other project, and it still work on that other project.
but thanks for the reply anyway
 
Top