The Sapphire is designated to provide useful methods to make programming as simple as possible. The code you shouldn't change isn't even commented and it's not made to be understood easily.
I use Ashton and since you are inexperienced and I'm quite helpful, I can explain you how does this work.
First you need:
-some game state/Gosu window with update and draw methods (obviously)
-an image for light (white circle on black background)(you can get it from 'data/core' directory in Sapphire example)
-and eventually a completely black or white image with size of your window.
In state's/window's initialize method, add these:
@lights=[] #an array to store lights
@darkness=Ashton::WindowBuffer.new #a canvas that you can draw on, used for the effect
You have to fill light's array with something in state's/window's update method. In my way, it's a temporary array, that is filled and cleared each frame. It should contain data for lights: position, radius, color, blur, whatever. You can put it into array, like [x,y,radius,color]. Light's position should be calculated to skip lights outside screen etc.
The Light class in my example is to fill the array with it's values
And in draw method:
@darkness.render do #start drawin on your canvas
##you need to clear the canvas each frame. For this one, you can either draw the full-black image or use a draw_quad method
##you need now to use each light to draw the prepared light image. Remember to draw it with :additive mode
You have to iterate through all lights, like this:
light_image.draw_rot(light_x, light_y, 0, 0, 0.5, 0.5, radius, radius, light_color, :additive) #add the values yourself
end
Then:
@lights.clear #clear the array to recalculate it later.
The above should be put in the beginning of draw method to avoid bugs in Ashton.
And after you done all your image drawing, draw the shadow over everything:
@darkness.draw(0, 0, darkness_z_order, :mode=>:multiply)
Some notes/advices:
-light image from Sapphire example contains multiple blur versions of light. You can achieve this effect also with shader, but you need to make one (well, I will, later)
-the full-white image I mentioned can be used as a light for half-dark shadows. Draw it :additive and gray
-there are two ways to organise code: one class per file and multiply classes per file (the one I use). If you use the second way, CTRL + F is your good friend
Hope you understood.