HUD Health Bar (want to rotate the draw.roundedbox)
7 replies, posted
Hello all :)
I have a little problem that I can not find the solution... :s:
I work on the HUD health bar in garry's mod and I can not rotate 90 degrees the "[B]draw.RoundedBox[/B]".
Here is an illustration:
[IMG]http://i.imgur.com/6T6YHzx.jpg[/IMG]
The code:
[CODE]
local x, y = 30, ScrH() - 20
local localplayer = LocalPlayer()
Health = math.min(100, (Health == localplayer:Health() and Health) or Lerp(0.1, Health, localplayer:Health()))
local DrawHealth = math.Min(Health / GAMEMODE.Config.startinghealth, 1)
local Border = math.Min(6, math.pow(2, math.Round(3*DrawHealth)))
if LocalPlayer():Health() > 0 then
draw.RoundedBox(0, 100, y -400, 100, (100) * DrawHealth, Color(255,40,40,255))
end[/CODE]
Can you help me please ?
Thank you very much.
My friend... lower the box on y coordinate? ;-;
Don't rotate, just lower it ._.
Also it is not 90 degrees, it is 180 degrees.
instead of y-400, try y-300-(100*DrawHealth), keep everything else the same.
"lower it" clearly that is what he is asking for
Hey thank you very much, it's the solution, it's work !
I have a second little problem if you can help me.
My fonction for show steam avatar:
[QUOTE]DrawPlayerAvatar( LocalPlayer() )
surface.SetMaterial( Material( "myfolder/front_of_avatar.png" ) );
surface.SetDrawColor(Color(255, 255, 255, 255))
surface.DrawTexturedRect( 116, ScrH() -180, 48, 10)
[/QUOTE]
And i want to add texture in front of the avatar but it's don't work.
The texture appears behind...
Can you help me please ? :)
[QUOTE=Noslen;50287221]Hey thank you very much, it's the solution, it's work !
I have a second little problem if you can help me.
My fonction for show steam avatar:
And i want to add texture in front of the avatar but it's don't work.
The texture appears behind...
Can you help me please ? :)[/QUOTE]
if DrawPlayerAvatar() uses derma you will have to draw the texture in that function
Do you have a exemple please Aj10017 ?
I tried but I could not get.
Rest of the code:
[CODE]local av
local name
local oldName
local function DrawPlayerAvatar( p )
oldName = LocalPlayer():Name()
print( oldName )
av = vgui.Create("AvatarImage")
av:SetPos(88,ScrH() - 204)
av:SetSize(48, 48)
av:SetPlayer( p, 64 )
end[/CODE]
:snip: I didn't realize you found a fix.
Sorry, you need to Log In to post a reply to this thread.