Uploaded February 2014 | Updated September 2026, 2 weeks ago
In this tutorial I'll be showing how to create a flashlight. I'm sorry for the somewhat poor quality in this video, I've tried to re-record it over and over with different settings but for some reason this is the best I could get it : ( Hopefully everything will be back to normal next tutorial : )
Code used in tutorial:
obj_light:
Create Event:
//Setting up black surface for our light shine through
dark = surface_create(room_width,room_height)
surface_set_target(dark)
draw_clear_alpha(c_black,0)
surface_reset_target()
Step Event:
//Setting up where we want our light to be created, in this instance
we want the light to stick with to the player's x & y positions
x=obj_player.x
y=obj_player.y
End Step Event:
//More surface stuff, you don't need to worry anything here besids the
mouse_x/mouse_y, that's how we move the light, you can change it if
you'd like to
surface_set_target(dark)
draw_clear(c_black)
draw_set_blend_mode(bm_subtract)
draw_sprite_ext(spr_light,0,x-view_xview,y-view_yview,1,1,point_direction(x,y,mouse_x,mouse_y),c_white,1,)
surface_reset_target()
draw_set_blend_mode(bm_normal)
Draw Event:
//Drawing this surface
draw_surface(view_xview, view_yview,dark)
Link to download example:
dropbox.com/s/7iepo555l6f8py4/flashlight_example_rexfurry.gmk
Link to RealTutsGML Tutorial:
youtube.com/watch?v=D6stK7GFwoE
In this tutorial I'll be showing how to create a flashlight. I'm sorry for the somewhat poor quality in this video, I've tried to re-record it over and over with different settings but for some reason this is the best I could get it : ( Hopefully everything will be back to normal next tutorial : )
Code used in tutorial:
obj_light:
Create Event:
//Setting up black surface for our light shine through
dark = surface_create(room_width,room_height)
surface_set_target(dark)
draw_clear_alpha(c_black,0)
surface_reset_target()
Step Event:
//Setting up where we want our light to be created, in this instance
we want the light to stick with to the player's x & y positions
x=obj_player.x
y=obj_player.y
End Step Event:
//More surface stuff, you don't need to worry anything here besids the
mouse_x/mouse_y, that's how we move the light, you can change it if
you'd like to
surface_set_target(dark)
draw_clear(c_black)
draw_set_blend_mode(bm_subtract)
draw_sprite_ext(spr_light,0,x-view_xview,y-view_yview,1,1,point_direction(x,y,mouse_x,mouse_y),c_white,1,)
surface_reset_target()
draw_set_blend_mode(bm_normal)
Draw Event:
//Drawing this surface
draw_surface(view_xview, view_yview,dark)
Link to download example:
dropbox.com/s/7iepo555l6f8py4/flashlight_example_rexfurry.gmk
Link to RealTutsGML Tutorial:
youtube.com/watch?v=D6stK7GFwoE



![Rexplays: Crystal Universe Aftermath - [4]
Hey everyone, how it goin? Welcome to part 4 of my brand new Lets pla...or should I say, Rexplay series of Crystal Universe Aftermath! In this episode, we journey into the fabled underground volcano and find our self in a bit of a HOT situation! What is to happen to our little hero Seth in this dangerous place? Find out for yourself in this episode, of rexplays Crystal Universe Aftermath! ^)^
Link to download game: http://sandbox.yoyogames.com/games/79955 Rexplays: Crystal Universe Aftermath - [4]](https://i.ytimg.com/vi/dyMdQJLO-dY/mqdefault.jpg)






