Flashlight (torch, etc.) lighting effect
pHghost
London, UKMember Posts: 2,342
Is there a smart way of faking the effect of a light-source in darkness? Imagine a character in pitch dark, carrying for example a torch. The light should follow him around, illuminating the surroundings to a specific distance.
Something along the lines of:
Comments
I'm sure you've seen the device-sized-black image with a whole cut out in the center, right? Would that suit your purpose? Not the best effect but I'm sure with some work it could look decent.
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
Just constrain a camera size actor with a hole in the centre.
As the edges tend to be soft, the image can be fairly small, say 256 x 256.
The problem with that approach is that it permits only one light source, you cannot have two characters with torches, or other lights.
I appreciate the responses!
Unfortunately, there is no dynamic lighting in GameSalad.
I know there is no dynamic lighting, that's why I'm trying to figure out if there is a way to fake it somehow, but it's possible there is no way out.
If you have a single layer for the background, you can do it through the multiply blend mode, but once you need more actors that are affected by it, the multiply messes it up.
@pHghost Ok... here is an example of poor man's lighting. It's fairly resource intensive and if you want it to be even more granular, it would become even more so.
What it does is have 3 tag types - bright light (closest), midlight (fading light) and dim light (the fringes of the light). Bright light is transparency 0 (so background, etc shows through), midlight is 75% transparent and dim light is 50%. Everything else is transparency 1 on black actors that cover the screen in a 50x50 grid.
The bright light is 100x100 in a circular collision pattern, midlight is 200x200 and dim light is 300x300.
You can walk around with A &D keys and the light will follow the player. There are two other light sources and they will combine and then go back to normal after the player has moved over them.
Right now, I show the grid being created but obviously you can remake it prevent that.
Mac project file:
https://dropbox.com/s/o7521xan80kw41u/Dynamic%20Lighting%20001.zip?dl=0
Smart approach! I'll play with that, thanks!
@pHghost It's crude, but might be workable for something.
Here is an ancient thread that shows how old kipper used to do it. Maybe it will help.
http://forums.gamesalad.com/discussion/comment/299792#Comment_299792
And here is the file.
That's a really sharp way of doing it... just wondering if it can be applied towards a very active screen with lots of actors - that don't give off light.
Thanks for sharing these! I'll see how flexible I can make @ookami007 's method.
I currently use exactly the method that Kipper's demo does, but yes, it's a problem if you have a scene that is put together from many different actors on top of each other, because then the blending mode messes everything up. I might make it workable in v0.14, once the pixel art scaling is implemented, but for now I cannot do everything as one flat image, as it would make it a horror with memory management.
@RThurman, thats a great method, thanks for pulling it out of the archives.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
WOW! That Kipper multi light! So awesome!!!