I am currently using this as my code to do a circle to represent health. However, it is coming out clunky, and unappealing. Does anyone have a better function or idea I can use?
local clamp, cos, sin, deg2rad = math.Clamp, math.cos, math.sin, math.pi/180 function DrawPartialCircle( x, y, radius, linewidth, startangle, endangle, aa ) -- Thanks for getting me started on how to do this python1320 <3 aa = aa or 1; startangle = clamp( startangle or 0, 0, 360 ); endangle = clamp( endangle or 360, 0, 360 ); if endangle < startangle then local temp = endangle; endangle = startangle; startangle = temp; end for i=startangle, endangle, aa do local _i = i * deg2rad; surface.DrawTexturedRectRotated(cos( _i ) * (radius - linewidth) + x,sin( _i ) * (radius - linewidth) + y, linewidth, aa*2, -i ); end end
I would draw it with this.
DrawPartialCircle( 80, ScrH() - 70, 65, 13, 0, math.max( 0, client:Health() ) * 3.6, 1 )