HUD not working with camera.angle, camera.setSize and camera.zoom



  • Hey,

    I am rotating the camera in and top-down game every time the player is changing its direction. For this the camera is set a larger size to avoid black areas. Also I am changing the scale of the camera based on the screen size of the device.

    My problem is: The HUD Elements are not visible based on the zooming scale as well as camera size AND they are rotating with the camera!

    Do you have any idea how I can approach this issue? Can I do a REALLY fixed HUD? The scrollFactor.set(0,0) solution is not enough for this issue...

    Thank you :)


  • administrators

    You can put the HUD into a completely separate camera.



  • Hey, Gama11!Thank you so much! This hint was really what I was looking for. It seems like this was a noob question... Now I find a lot of stuff about this. Sorry for that.

    Here is how I made it work, which "_hud" being a group, which contains the HUD Sprites and "_playGround" containing all the Objects that are rotated with the default camera:

        _hudCamera = new FlxCamera(0, 0, FlxG.width,FlxG.height, 1  );
        _hudCamera.bgColor = FlxColor.TRANSPARENT;
        FlxG.cameras.add(_hudCamera);
        _hud.forEach(function(el) {
            el.cameras = [_hudCamera];
        }); 
        _playGround.forEach(function(el) {
            el.cameras = [camera];
        });

Log in to reply
 

Looks like your connection to HaxeFlixel was lost, please wait while we try to reconnect.