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
Step Event
Draw Event
Creating the Light In End Step Event
because this way use too much memory
Create Event
Code:
globalvar Light;
Light = surface_create(room_width,room_height);
Alpha = 1;
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();
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);
}
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: