Question

Making a prototype for a platformer that uses moving and stationary light sources and encountering some tricky problems and just basically looking for some sort of workaround or alternate solution.

For my first idea I just used 2 masks, one for the background and one for an enemy, the background looks exactly like I want it to, but unfortunately as the light moves closer to and away from the enemy you can see through it to the background as you can see in the file below.

swf: http://efullick.com/light/light_test.swf

So then I thought that it might make more sense to keep the enemy and background constantly opaque and just mask out part of a big black layer of darkness that's over top of it, and got about to this point;

swf: http://efullick.com/light/darkness_test.swf

So I've realized that obviously I'd have to reverse the mask so that instead of having it create a point of darkness it'd have a lot of darkness with a hole in it in order to make this approach work, but I'm not really sure how I'd do this effectively with multiple light sources.

Any ideas?

Was it helpful?

Solution

If you put enemy and background into one container with light mask applied to container, this should fix enemy appearance. And mask can be composed from masks on each light - their areas will be combined, but lighting will not add.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top