Fangames > Programming Questions
Spotlight Effects From Kill The Guy?
Realtime911:
How do I make the spotlight effect like in kill the guy, it seems very flexible. Up until now, I use sprite as an spotlight effect, but that doesn't help me if there's two or more light sources
Any help is appreciated!
L4Vo5:
I tought about making a surface where everything is black (with low alpha if you want) and somehow making whole sections (the sections where the light would be on) be removed, but i don't know if you can really remove sections like that (maybe with shaders?)
WetWookie:
You're just about right. You create a surface and draw a black rectangle. The alpha you use when drawing the rectangle determines how dark it is where there is no light. Alpha of 1 is pitch black. Alpha of 7 is gloomy but visible. You then set the draw mode to subtract draw_set_blend_mode(bm_subtract); and draw your 'light' sprites at the location of all your light sources which removes the blackness of the rectangle you drew earlier. Set draw mode back to normal and draw your surface.
lawatson:
Just be wary that bm_subtract likes to be a bitch with certain effects, so things like draw_set_blend_mode_ext(bm_dest_alpha,bm_inv_src_alpha) might work better assuming you have surface code which would work with it correctly.
Realtime911:
ah, I'm sorry but I'm still new to these draw codes so I'm still a bit confused, can you make an example for it?
Navigation
[0] Message Index
[#] Next page
Go to full version