Skip to content

Instantly share code, notes, and snippets.

@qoh
Last active December 14, 2015 22:48
Show Gist options
  • Save qoh/5160868 to your computer and use it in GitHub Desktop.
Save qoh/5160868 to your computer and use it in GitHub Desktop.
function tacticalHUD::updateControls( %this, %width, %height )
{
%this.healthMeter.updateControls( %width, %height );
}
function tacticalHUD_healthMeter::updateControls( %this, %width, %height )
{
%x = tacticalHUD.x + ( ( %width / 2 ) - 170 )
%y = tacticalHUD.y + 182;
%this.position = %x SPC %y;
%this.extent = "400 8";
%this.bar.updateControls( %width, %height );
}
function tacticalHUD_healthMeter_bar::updateControls( %this, %width, %height )
{
%health = 75;
%factor = mClampF( %health / 100, 0, 1 );
%color = colorGradient( %factor, $THUD::Color[ "panic" ], $THUD::Color[ "default" ] );
%color = vectorScale( %color, 0.00625 );
%this.extent = 400 * %factor SPC 8;
%this.setColor( %color SPC 160 / 255 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment