Excellent scripts. I could really use the draw_light_circle script.
A question though, is there a special way to use it because I made an object, no sprite, 0 depth, using your light script and changed spotbrightness to one and it made the entire room black and no light was present. How exactly do I use it for my game?
The variable I made called spotbrightness is just a small number that would get smaller as the cursor goes farther from the spotlight.
Though I passed this value into the script (so that the spotlight's "spot" would get dimmer the farther it was from the spotlight's origin), there usually is no need for this kind of variable.
In order to use the script, go into the object's drawing event and enter
draw_light_circle(x1,y1,r1,c1,a1,x2,y2,r2,c2,a2,quantity)
This function draws a light by creating a bunch of overlapping semi-transparent circles from position (x1,y1) to (x2,y2)
The number of circles from (x1,y1) to (x2,y2) will be equal to the last argument passed ("quantity"). Increasing quantity can make the light look nicer but takes more power to draw. Also be aware of how changing quantity will change the apparent transparency if you happen to be drawing the circles such that they overlap.
The circles will vary in size from having radius r1 at (x1,y1) to having radius r2 at (x2,y2)
The circles will vary in color from having color c1 at (x1,y1) to having color c2 at (x2,y2)
The circles will vary in transparency from having alpha a1 at (x1,y1) to having alpha a2 at (x2,y2)
Be aware that the transparency of the center of the light will depend also on the number of circles that overlap at a particular point.
The transparency of the light at a point is equal to
(a + a^2 + a^3 + ... + a^n)
where a is the alpha value for each circle and n is the number of overlapping circles at the point of interest
For example, the game I'm working on now has a simple circular light that is coded by
draw_light_circle(x,y,3,c_white,0.1,x,y,9+random(7),c_red,0.3,5);
This draws 5 circles at position (x,y) (note that in this case x1=x2=x and y1=y2=y, so all the circles are drawn at (x,y)). The first circle has radius 3, is colored white, and has a transparency of 0.1. the last circle has a radius of 9+random(7), is colored red, and has a transparency of 0.3. The 3 circles between the first and last ones have values in between these. 0.1 and 0.3 may seem like very low transparencies, but keep in mind that in this case the circles are being drawn over each other, so it should appear reasonably visible. Try experimenting with this example, since it's more basic.