开发者

2d platformer light sources

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开发者_JS百科/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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜