Advertisement
Guest User

Untitled

a guest
Feb 19th, 2018
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. if SERVER then return end
  2.  
  3. local lerp = 0
  4. local pos = ScrH() / 2 + 50
  5. local pos2 = ScrH() * 2
  6.  
  7. local x = ScrW()/2 - 100
  8.  
  9.  
  10. local frame = vgui.Create("DFrame")
  11. frame:SetSize(200,100)
  12. frame:MakePopup()
  13. frame:SetPos(0,pos2)
  14. frame.Paint = function(self, w, h)
  15. surface.SetDrawColor(0,255,255)
  16. surface.DrawRect(0,0,w, h)
  17. if lerp != 1 then
  18. local _,y = self:GetPos()
  19. self:SetPos(x, Lerp(lerp, y, pos) )
  20. lerp = math.Clamp(lerp + 0.01, 0, 1)
  21. end
  22. end
  23.  
  24. local but = vgui.Create("DButton", frame)
  25.  
  26. Stage 1, moving derma
  27.  
  28.  
  29.  
  30. local x,y = 50, ScrH() - 200
  31. local pl = LocalPlayer()
  32. hook.Add("HUDPaint", "tutorial hud",function()
  33. surface.SetDrawColor(255,0,0)
  34. surface.DrawRect(x,y,math.Clamp(500 * ( pl:Health() / pl:GetMaxHealth() ), 0, 500 ), 20)
  35. surface.SetDrawColor(0,0,0)
  36. surface.DrawOutlinedRect(x, y, 500, 20 )
  37. draw.SimpleText( pl:Health() .. "%", "DermaDefault", x + 5, y + 10, Color(255,255,255) ,0, 1)
  38. end)
  39.  
  40. Simple HUD
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement