Game Maker Studio: How to have Light Follow the Player.
Visit my Search Arena site: https://searcharena.wordpress.com/
GMX File: https://bit.ly/2FO9L0y
Light Flicker Link: https://www.youtube.com/watch?v=k2t2Q4iAI5c&t=338s
obj_player
Events:
Step
Actions:
if(keyboard_check(vk_left)){
x -= 10;
}
if(keyboard_check(vk_right)){
x += 10;
}
if(keyboard_check(vk_up)){
y -= 10;
}
if(keyboard_check(vk_down)){
y += 10;
}
Events:
End Step
Actions:
size = 300;
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_orange,c_black,false);
surface_reset_target();
draw_set_blend_mode(bm_normal)
obj_lighting
Events:
Create
Events:
globalvar light;
light = surface_create(view_wview,view_hview)
Events:
Step
Actions:
surface_set_target(light);
draw_set_color(c_white);
draw_rectangle(0,0,view_wview,view_hview,false)
surface_reset_target();
Events:
Draw
Actions:
draw_set_blend_mode(bm_subtract);
draw_surface(light,view_xview,view_yview);
draw_set_blend_mode(bm_normal);