package;

 import flixel.FlxBasic;
 import flixel.FlxG;
 import flixel.FlxSprite;
 import flixel.group.FlxGroup.FlxTypedGroup;
 import flixel.text.FlxText;
 import flixel.util.FlxColor;
 using flixel.util.FlxSpriteUtil;

 class HUD extends FlxTypedGroup<FlxSprite>
 {
    private var txtIsHidden:FlxText;
	private var txtHealth:FlxText;
	private var clipsCount:FlxText;
     public function new()
     {
        super();
        txtIsHidden = new FlxText(10, 20, 0, "Hidden");
		txtIsHidden.visible = false;
		txtHealth = new FlxText(10, 10, 0, "Health: ");
		clipsCount = new FlxText(txtHealth.x + txtHealth.width + 15, 10, 0, "Clips: ");
		add(txtIsHidden);
		add(txtHealth);
		add(clipsCount);
		forEach(function(s:FlxSprite)
		{
			// This makes sure the HUD does not move with the camera scroll
			s.scrollFactor.set(0, 0);
			// We only want out HUD to display on the main camera
			s.cameras = [FlxG.camera];
		});
     }

     public function updateHUD(isHidden:Bool = false, health:Float = 0, clips:Int = 0):Void
     {
        txtIsHidden.visible = isHidden;
		txtHealth.text = "Health:" + health;
		clipsCount.text = "Clips: " + clips;
     }
 }
