don't draw darkness unless there are shaped lights
This commit is contained in:
@@ -489,13 +489,19 @@
|
||||
(Night NIGHT_COLOR)
|
||||
(otherwise FlxColor.TRANSPARENT)))
|
||||
(darkness.makeGraphic FlxG.width FlxG.height darkColor true)
|
||||
(doFor source lightSources (drawLight source))
|
||||
// When there are no shaped light sources, don't draw darkness, it's usually just annoying.
|
||||
(localVar &mut lightIsHere false)
|
||||
(doFor source lightSources
|
||||
(set lightIsHere true)
|
||||
(drawLight source))
|
||||
(blackAlphaMaskFlxSprite darkness lightMask darkness)
|
||||
(set lightSprite.cameras [flxMovie.screenCamera])
|
||||
(set darkness.alpha darkColor.alphaFloat)
|
||||
(set darkness.cameras [flxMovie.screenCamera])
|
||||
(FlxG.state.add darkness)
|
||||
(FlxG.state.add lightSprite))
|
||||
// TODO put these in defined sprite layers!
|
||||
(when lightIsHere
|
||||
(FlxG.state.add darkness)
|
||||
(FlxG.state.add lightSprite)))
|
||||
|
||||
(method :Void hideLighting []
|
||||
(when darkness
|
||||
|
Reference in New Issue
Block a user