• 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 Day Cycle

Imperial

Member
Is this the best way to make the Light System, If no please suggest me the best way to do It
because this way use too much memory

Create Event
Code:
globalvar Light;
Light = surface_create(room_width,room_height);
Alpha = 1;
Step Event
Code:
surface_set_target(Light);
draw_set_color(c_gray);
draw_set_alpha(Alpha);
draw_rectangle(0,0,room_width,room_height,false);
draw_set_alpha(1);
surface_reset_target();
Draw Event
Code:
if surface_exists(Light)
{
    draw_set_blend_mode(bm_subtract);
    draw_surface_ext(Light,view_xview[view_current],view_yview[view_current],1,1,0,-1,Alpha);
    draw_set_blend_mode(bm_normal);
}
else
{
    Light = surface_create(room_width,room_height);
}
Creating the Light In End Step Event
Code:
if instance_exists(control_Light)
{
    size = 128;
    draw_set_blend_mode(bm_subtract);
    surface_set_target(Light);
    draw_ellipse_color(x-size/2-view_xview,y-size/2-view_yview,x+size/2-view_xview,y+size/2-view_yview,c_white,c_black,false);
    surface_reset_target();
    draw_set_blend_mode(bm_normal);
}
 
Last edited:
Top