FlxCamera problem



  • I have a shader effect applied to the default camera which makes it look like night time (dark, blue-ish color).
    I didn't want this effect to be applied to my gui elements, so I made a new camera for this and assigned some gui stuff to it like so:

    FlxG.cameras.add(guiCamera);
    guiThing1.cameras = [guiCamera];
    

    However, after doing this, the shader effect is no longer visible... so then I tried setting the background color of the new camera to transparent like so:

    guiCamera.bgColor = FlxColor.TRANSPARENT;
    

    After doing this, the shader effect becomes visible again, but the gui-elements disappear; it turns out that they always disappear when you set the camera's background color to transparent. Is this... normal?

    I guess I could set the shader property on every single thing in the game, except for the gui-stuff, if nothing else works. Does anyone have any ideas or suggestions?



  • Have you considered using this demo code instead:

    http://haxeflixel.com/demos/DynamicShadows/

    And remove the radius. I think.

    Or the same thing with this library:

    https://github.com/01010111/zerolib

    With a ZSpotLight. Simply add the spotlight below your gui in your create.

            var spotlights = new ZSpotLight(0xff004080);
    	spotlights.add_to_state();
    	spotlights.add_light_target(mouseCon, 0);


  • Thanks for the reply.
    Actually, I'm the one who made that DynamicShadows demo :p Anyways, I'm on OpenFl Next and blend modes don't work properly there as far as I can tell (don't think they ever have)... I'll have to do some more experimenting :alembic:



  • Oh. Your welcome for the reply. Sorry I wasn't any help.



  • It turns out that it was a bug that made stuff disappear when the camera's bgColor was transparent. I upgraded to the latest git version of flixel and got it working again.


Log in to reply